Skip to content

Instantly share code, notes, and snippets.

@joneshf
Last active March 5, 2017 14:39
Show Gist options
  • Save joneshf/5841de0d567202e1c80e to your computer and use it in GitHub Desktop.
Save joneshf/5841de0d567202e1c80e to your computer and use it in GitHub Desktop.
module A3gis where
import Data.Traversable
import Data.Map
import Data.Maybe
foo :: forall k v. (Eq v, Ord k) => Map k v -> Map k v -> Maybe (Map k v)
foo m1 m2 = sequence $ unionWith go (Just <$> m1) (Just <$> m2)
where
go x y = if x == y then x else Nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment