summaryrefslogtreecommitdiff
path: root/pole.hs
blob: 4ec54d40e5c2d0203ce20f34d34a3bdd9283ba36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
type Birds = Int
type Pole = (Birds, Birds)

landLeft :: Birds -> Pole -> Maybe Pole
landLeft n (left, right)
    | abs((left+n) - right) < 4 = Just (left + n, right)
    | otherwise                 = Nothing

landRight :: Birds -> Pole -> Maybe Pole
landRight n (left, right) 
    | abs((right+n) - left) < 4 = Just (left, right + n)
    | otherwise                 = Nothing

foo = do
    x <- Just 3
    y <- Just "!"
    Just (show x ++ y)

routine = do
    start <- return (0,0)
    first <- landLeft 2 start
    second <- landRight 2 first
    landLeft 1 second

wopwop = do
    (x:xs) <- Just ""
    return x