#5138: TypeSynonymInstances should be enabled by default
---------------------------------+------------------------------------------
    Reporter:  mcandre           |       Owner:                                 
   
        Type:  feature request   |      Status:  new                            
   
    Priority:  normal            |   Component:  Compiler                       
   
     Version:  7.0.2             |    Keywords:  type synonyms instance 
declaration
    Testcase:                    |   Blockedby:                                 
   
          Os:  Unknown/Multiple  |    Blocking:                                 
   
Architecture:  Unknown/Multiple  |     Failure:  GHC rejects valid program      
   
---------------------------------+------------------------------------------
 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5138>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to