TypeSynonymInstances should be enabled by default

Andrew Pennebaker andrew.pennebaker at gmail.com
Wed Apr 20 21:38:38 CEST 2011


Source: https://github.com/mcandre/genetics

With {-# LANGUAGE TypeSynonymInstances #-} , my genetic algorithm code
compiles and runs perfectly.

$ make
$ ./helloga
...
hellowobld
helloworyd
helloporld
hellyworld
helloworrd
hellowofld
hellpworld
Best candidate: helloworld

Without it, Haskell refuses to declare an instance on Strings.

$ make
ghc --make -O2 -fforce-recomp helloga.hs
[1 of 2] Compiling Genetics ( Genetics.hs, Genetics.o )
[2 of 2] Compiling Main ( helloga.hs, helloga.o )

helloga.hs:27:10:
     Illegal instance declaration for `Gene String'
       (All instance types must be of the form (T t1 ... tn)
       where T is not a synonym.
       Use -XTypeSynonymInstances if you want to disable this.)
     In the instance declaration for `Gene String'
make: *** [all] Error 1

The fix is easy to discover and apply, but this is my first typeclass,
nothing complicated. As a newbie I prefer that it "just works" without my
having to use the special compile flag.

Cheers,

Andrew Pennebaker
www.yellosoft.us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-prime/attachments/20110420/618914a7/attachment.htm>


More information about the Haskell-prime mailing list