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