2 ms·
\cases is a nice syntax improvement https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0302-cases.rst https://github.com/ghc-proposals/ghc-pro
by platz 4y ago
\cases is a nice syntax improvement https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0302-cases.rst https://github.com/ghc-proposals/ghc-proposals/blob/master/p...
\foo bar baz -> case (foo, bar, baz) of
(Just 4, 3, False) -> 42
_ -> 0
-- becomes
\cases
(Just 4) 3 False -> 42
_ _ _ ->
---
extremelyLengthyFunctionIdentifier (Just a) False = Just 42
extremelyLengthyFunctionIdentifier (Just a) True = Just (a / 2)
extremelyLengthyFunctionIdentifier _ _ = Nothing
-- becomes
extremelyLengthyFunctionIdentifier = \cases
(Just a) False -> Just 42
(Just a) True -> Just (a / 2)
_ _ -> Nothing