Skip to content

Instantly share code, notes, and snippets.

@bryant
Created October 18, 2015 20:54
Show Gist options
  • Save bryant/adb972acf9d041907ef7 to your computer and use it in GitHub Desktop.
Save bryant/adb972acf9d041907ef7 to your computer and use it in GitHub Desktop.
{-# LANGUAGE MultiParamTypeClasses #-}
class C a b where
idk :: a -> b -> Maybe (a, b)
instance C Int Bool where idk _ _ = Nothing
f :: Int -> Bool -> [Either Int Bool]
f a b =
let g a b = maybe [] (const $ []) $ idk a b in
let h thing = g a thing in
g a b
{-
wtfwtf.hs:11:9:
Non type-variable argument in the constraint: C Int b
(Use FlexibleContexts to permit this)
When checking that ‘h’ has the inferred type
h :: forall t b. C Int b => b -> [t]
In the expression: let h thing = g a thing in g a b
In the expression:
let g a b = maybe [] (const $ []) $ idk a b in
let h thing = g a thing in g a b
Failed, modules loaded: none.
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment