Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-}
module Lib where
class C a b | a -> b
instance C () Int
class Foo a where
foo :: C a b => a -> b -> IO ()
instance Foo () where
foo () int =
print int
{-
/home/matt/Projects/fundeps/src/Lib.hs:13:9: error:
• Could not deduce (Show b) arising from a use of ‘print’
from the context: C () b
bound by the type signature for:
foo :: forall b. C () b => () -> b -> IO ()
at src/Lib.hs:12:5-7
Possible fix:
add (Show b) to the context of
the type signature for:
foo :: forall b. C () b => () -> b -> IO ()
• In the expression: print int
In an equation for ‘foo’: foo () int = print int
In the instance declaration for ‘Foo ()’
|
13 | print int
| ^^^^^^^^^
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.