Quick actions

cmd+k|ctrl+k

Navigation

Languages

tertiary operators

Snippet info

Language

Haskell

Visibility

public

Author

danielmg17

Created

2019-06-27T14:01:43Z

Updated

2019-06-27T14:18:38Z

-- tertiary operators in haskell? Am I cool or what?

infixl 7 ?
(?) :: Bool -> (a,a) -> a
(?) True (x,_) = x
(?) False (_,y) = y

infixr 8 .:
(.:) ::  a -> a -> (a,a)
(.:) x y = (x,y)

main = do
    putChar $ (4>3) ? 't' .: 'f'
    putChar $ (3>4) ? 't' .: 'f'
INFO