[Haskell-cafe] checking types with type families

Kevin Quick quick at sparq.org
Sat Jul 3 16:01:12 EDT 2010

On Sat, 03 Jul 2010 12:48:56 -0700, Dan Doel <dan.doel at gmail.com> wrote:

> Then the instance declares infinitely many instances C Bool a a. This is a
> violation of the fundep. Based on your error message, it looks like it ends up
> treating the instance as the first concrete 'a' it comes across, but who
> knows?

Hmmm.. it doesn't look like a first concrete lockdown.  The following works fine:

opres1 :: Int -> Int
opres1 = op True

opres2 :: String -> String
opres2 = op True

main = do putStrLn $ op True "start"
           putStrLn $ show $ opres1 5
           putStrLn $ opres2 $ opres2 $ show $ opres1 6
           putStrLn $ opres2 "done"

As a side note, although I agree it abuses the fundeps intent, it was handy for the specific purpose I was implementing to have a "no-op/passthrough" instance of op.  In general I like the typedef approach better, but it looks like I must sacrifice the no-op to make that switch.


More information about the Haskell-Cafe mailing list