Hi,
In Prelude.hs you can find the definition
enumFrom x = map toEnum [ fromEnum x ..]
Load a file.hs of just one line:
data TBool = Falsity | Undefined |Truth deriving (Enum, Show)
Then, I evaluate
enumFrom Falsity
and, as expected, it gives
[Falsity,Undefined,Truth]
However, the expression
map toEnum [ fromEnum Falsity ..]
gives first an ambiguity problem and then the problem I expected
Main> map toEnum [ fromEnum Falsity ..]
ERROR - Unresolved overloading
*** Type : Enum a => [a]
*** Expression : map toEnum (enumFrom (fromEnum Falsity))
Main> map toEnum [ fromEnum Falsity ..]::[TBool]
[Falsity,Undefined,Truth,
Program error: {_toEnum TBool_Falsity 3}
(98 reductions, 301 cells)
Why the function enumFrom works perfectly in spite of its erroneous
definition?
Thanks in advance,
Paqui
P.D.
I am using the
|| || || || || || ||__ Hugs 98: Based on the Haskell 98 standard
||___|| ||__|| ||__|| __|| Copyright (c) 1994-2002
||---|| ___|| World Wide Web: http://haskell.org/hugs
|| || Report bugs to: hugs-bugs(a)haskell.org
|| || Version: Nov 2002
---------------------------------
Paqui Lucio
Dpto de LSI
Facultad de Informática
Paseo Manuel de Lardizabal, 1
20080-San Sebastián
SPAIN
---------------------------------
e-mail: paqui.lucio(a)ehu.es
Tfn: (+34) (9)43 015049
Fax: (+34) (9)43 015590
Web: http://www.sc.ehu.es/paqui
---------------------------------
Daniel Fischer wrote:
> Am Sonntag 27 September 2009 01:16:12 schrieb John Vitale:
>
>> I have downloaded and installed... and reinstalled winhugs to my computer..
>> it works fine but the text editor that opens up by default is notepad...
>> does winhugs come with a text editor of it's own? If so what is it? if
>> not what would you suggest? My university has a completely different text
>> editor when i use it there and i would love to have that same thing for
>> here.
>>
>
> There must be a way to set the default editor. I don't know how WinHugs behaves, though
> it's probably the same as Hugs.
> The default default-editor there is what your EDITOR environment variable says (may be
> called slightly differently on Windows).
> You can change that by
>
> :set -E/usr/bin/myeditor
>
> (on Windows, more likely
> :set -E"C:\Programs and Applications\ed")
>
> in (win)hugs.
> That isn't permanent, however, so you'd want to put that line into your ~/.hugs
> (~/.winhugs) file so that the editor is set on every startup.
> Or change the environment variable to your preferred editor (a reasonable thing to do
> anyway).
>
>
In WinHugs, you set the editor by going to File | Options and on the
"WinHugs" tab, there's a section called "Editor". It's actually really
hard to miss.
Given that the only built-in options it offers are "Notepad" and
"Custom", it's safe to conclude that it doesn't ship with any other
editor. I use Programmer's Notepad 2, which is available as freeware.
Someone has posted a syntax highlighting definition set for PN2 here:
http://compsci.ca/v3/viewtopic.php?t=14630
I have not tried it myself.