Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,3 @@
undefined -- undefined value provided by the standard library
error "oops" -- another undefined value
head [] -- undefined, you can't take the head of an empty list

View file

@ -0,0 +1 @@
data Maybe a = Nothing | Just a

View file

@ -0,0 +1,3 @@
case thing of
Nothing -> "It's Nothing. Or null, whatever."
Just v -> "It's not Nothing; it is " ++ show v ++ "."

View file

@ -0,0 +1,4 @@
add_two_maybe_numbers x y do
a <- x
b <- y
return (a+b)

View file

@ -0,0 +1,4 @@
*Main> add_two_maybe_numbers (Just 2) (Just 3)
Just 5
*Main> add_two_maybe_numbers (Just 2) Nothing
Nothing