Skip to content

Instantly share code, notes, and snippets.

@m2ym
Created January 12, 2014 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m2ym/8384137 to your computer and use it in GitHub Desktop.
Save m2ym/8384137 to your computer and use it in GitHub Desktop.
Data.Heap.MaxPrioHeap can't type fmap
import qualified Data.Heap as H
h :: H.MaxPrioHeap Int Char
h = H.fromList [(1, 'a')]
h' :: H.MaxPrioHeap Int String
h' = fmap (:[]) h
main :: IO ()
main = do
print h
print h'
a.hs:7:17:
Couldn't match type `Char' with `[Char]'
Expected type: H.HeapT (H.Prio H.FstMaxPolicy (Int, String)) Char
Actual type: H.MaxPrioHeap Int Char
In the second argument of `fmap', namely `h'
In the expression: fmap (: []) h
In an equation for h': h' = fmap (: []) h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment