I actually see this code in the document for eval1
, which should typecheck fine (I re-indented it):
eval1 env (Var n) =
maybe (fail ("undefined variable: " ++ n)) return $
Map.lookup n env
It seems that Map.lookup
did earlier have the more general signature: http://hackage.haskell.org/package/containers-0.1.0.0/docs/Data-Map.html
Since the document dates from 2006 and still has the text you quote above stating that Map.lookup
has the more general signature, but a footnote at the beginning saying "Ported to newer GHC in 2012", I think that the code has been updated but the text hasn't.
Edit:
I tracked down the history of the change in Map.lookup
, dating from 2008: Code change, Trac ticket, Libraries list discussion