churf/test_program
2023-03-03 11:46:54 +01:00

30 lines
528 B
Text

-- data Bool () where {
-- True : Bool ()
-- False : Bool ()
-- };
--
-- main : _Int ;
-- main = case True of {
-- False => 0 ;
-- True => 1
-- };
data List ('a) where {
Nil : List ('a)
Cons : ('a) -> List ('a) -> List ('a)
};
data Maybe ('a) where {
Nothing : Maybe ('a)
Just : 'a -> Maybe ('a)
};
safeHead : List ('a) -> Maybe ('a) ;
safeHead xs =
case xs of {
Nil => Nothing ;
Cons x xs => Just x
};
main : Maybe (_Int) ;
main = safeHead (Cons 0 (Cons 1 Nil)) ;