[Haskell-cafe] FD problem in GHC 6.6

Dan Weston westondan at imageworks.com
Tue Dec 19 22:11:15 EST 2006


 > instance CommandFunction (Sh st ()) st where
                                ^
I think your first argument (on which the second has a functional 
dependence) does not determine the second argument, since it makes use 
of st in the first argument. This strikes me as a likely place to begin.

Dan

Robert wrote:
> Fellow Haskellers,
> 
> I have a package that uses some light typeclass hackery to automaticly
> build parsing algorithms based on the type of a function.
> 
> I was recently informed that my package doesn't compile on GHC 6.6 due
> to the new restrictions on FD resolution; in particular I have instance
> declarations which fail the coverage condition.  I can use undecidable
> instances to make the package compile again, but I'd prefer not to if I
> can avoid it.
> class CommandFunction f st | f -> st where
>   parseCommand  :: String -> f -> CommandParser st
>   commandSyntax :: f -> [Doc]
> 
> instance CommandFunction (Sh st ()) st where



>   parseCommand wbc m str =
>          -- list monad
>          do (x,[]) <- runRegex (maybeSpaceBefore (Epsilon (CompleteParse
>          m))) str
>             return x
> 
>   commandSyntax _ = []
> 
> instance CommandFunction r st
>       => CommandFunction (Int -> r) st where
>   parseCommand = doParseCommand Nothing intRegex id
>   commandSyntax f = text (show intRegex) : commandSyntax (f undefined)
> 
> instance CommandFunction r st
>       => CommandFunction (Integer -> r) st where
>   parseCommand = doParseCommand Nothing intRegex id
>   commandSyntax f =  text (show intRegex) : commandSyntax (f undefined)




More information about the Haskell-Cafe mailing list