blob: c678339890af63b3e1402a270c48b30197e4b405 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
{-# LANGUAGE Arrows, LambdaCase #-}
module Main (main) where
import Control.Arrow
main :: IO ()
main = do
putStrLn $ foo (Just 42)
putStrLn $ foo (Just 500)
putStrLn $ foo Nothing
foo :: ArrowChoice p => p (Maybe Int) String
foo = proc x ->
(| id (\case
Just x | x > 100 -> returnA -< "big " ++ show x
| otherwise -> returnA -< "small " ++ show x
Nothing -> returnA -< "none")
|) x
|