Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A simple data structure helping us ask questions of the following sort: "does all this data have the same BLANK and if so what is it?"
For example: > doTheseHaveTheSameLength :: [String] -> String > doTheseHaveTheSameLength l = case foldMap (Somebody . length) of > Somebody n -> "They all have length " <> show n > Nobody -> "The lengths differ" > Anybody -> "You didn't give me any strings"