kempe-0.2.0.7: lib/either.kmp
; I'm not sure how useful this module is but I have it as a test for the
; typechecker and I guess to show how pattern matching works.
type Either a b { Left a | Right b }
fromRight : b ((Either a) b) -- b
=: [
{ case
| Left -> drop
| Right -> dip(drop)
}
]
join : ((Either a) ((Either a) b)) -- ((Either a) b)
=: [
{ case
| Left -> Left
| Right ->
}
]
isLeft : ((Either a) b) -- Bool
=: [
{ case
| Left -> drop True
| Right -> drop False
}
]
isRight : ((Either a) b) -- Bool
=: [
{ case
| Right -> drop True
| Left -> drop False
}
]