Skip to content

Instantly share code, notes, and snippets.

@jsl
Last active December 27, 2015 08:09
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 jsl/7294493 to your computer and use it in GitHub Desktop.
Save jsl/7294493 to your computer and use it in GitHub Desktop.
Deserialization breaking the way that Haskell looks up keys in Maps?
λ: import qualified Data.Map as M
λ: :t M.keys Metadata.Prelude.interfaces
M.keys Metadata.Prelude.interfaces :: [String]
λ: M.keys Metadata.Prelude.interfaces
["Automaton","Basics","Bitwise","Char","Color","Date","Dict","Either","Http","JavaScript","Json","Keyboard","List","Maybe","Mouse","Prelude","Random","Regex","Set","Signal","String","Text","Time","Touch","Transform2D","WebSocket","Window","Graphics.Collage","Graphics.Element","Graphics.Input","JavaScript.Experimental"]
λ: M.member "Graphics.Element" Metadata.Prelude.interfaces
False
λ: M.member "Graphics.Element" $ M.fromList $ M.toList Metadata.Prelude.interfaces
True
@jsl
Copy link
Author

jsl commented Nov 3, 2013

Metadata.Prelude.interfaces is loaded from a file using Binary's decodeOrFail. For some reason it's unable to figure out if a given string is an existing key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment