{{ message }}

Instantly share code, notes, and snippets.

# Icelandjack/Trac_10843.markdown

Last active Jun 13, 2017
GHC Trac #10843

This should allow

`curry \$ \case`

without the dollar giving us weird code

```data N = O | S N

add :: N -> N -> N
\case ->
(O,   b) -> b
(S a, b) -> S (add a b)```

Good for defining a recursive ('curried') binary data type in GHCi without too much noise (as if this matters)

`curry \case (Just x, Just y) -> Just (x <> y); _ -> Nothing`

### Icelandjack commented Jun 7, 2017

 I propose an essential language extension, `-XCurryCase` which lets you write `curry \case` as `\currycase` 🤣

### Icelandjack commented Jun 13, 2017

 The recent `Key` Monad lets us mimic Arrow notation in user code ```-- addA :: Arrow a => a b Int -> a b Int -> a b Int -- addA f g = proc \$ \z -> do -- x <- f -< z -- y <- g -< z -- return \$ (+) <\$> x <*> y addA :: Arrow a => a b Int -> a b Int -> a b Int addA f g = proc \z -> do x <- f -< z y <- g -< z return \$ (+) <\$> x <*> y``` compared to ```addA :: Arrow a => a b Int -> a b Int -> a b Int addA f g = proc z -> do x <- f -< z y <- g -< z returnA -< x + y``` In an alternative universe with idiom brackets ```addA :: Arrow a => a b Int -> a b Int -> a b Int addA f g = proc \z -> do x <- f -< z y <- g -< z return [| x + y |]```