Created
March 13, 2019 04:10
-
-
Save parsonsmatt/4efe6755218489a886238db55ef8172d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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