vault backup: 2025-01-15 21:52:02
This commit is contained in:
parent
ec0baf3ef5
commit
3b791491a0
18
Untitled.md
18
Untitled.md
@ -1,6 +1,24 @@
|
|||||||
```haskell
|
```haskell
|
||||||
add :: (Int -> Int) -> Int
|
add :: (Int -> Int) -> Int
|
||||||
add x y = x+y
|
add x y = x+y
|
||||||
|
|
||||||
|
instance Eq Bool where
|
||||||
|
True == True = True
|
||||||
|
False == False = True
|
||||||
|
_ == _ = False
|
||||||
|
|
||||||
|
instance (Eq a, Eq b) => Eq (a, b) where
|
||||||
|
(x1, y1) == (x2, y2) = x1 == x2 && y1 == y2
|
||||||
|
|
||||||
|
-- A value that exists
|
||||||
|
myValue :: Maybe Int
|
||||||
|
myValue = Just 42
|
||||||
|
|
||||||
|
-- A value that doesn't exist
|
||||||
|
noValue :: Maybe Int
|
||||||
|
noValue = Nothing
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user