Advertisement
Guest User

Untitled

a guest
Apr 19th, 2021
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. -- Item has a foo field of type Foo
  2. -- Foo has bar and bazzes fields of types Bar and [Baz]
  3.  
  4. func :: Item -> Map Bar [Baz]
  5. func i = case foo i of
  6. Nothing -> mempty
  7. Just fu -> Map.fromListWith (++) tups
  8. where tups = map (\x -> (bar x, bazzes x)) fu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement