aboutsummaryrefslogtreecommitdiff
path: root/test.txt
blob: 072ac192a5fa35ec9986d9fc27ccd67657de7a72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
fmap f p = Parser ((.) (fmapEither (fmap1st f)) (runParser p));

fmapEither f e = case e of {
    Left x  -> Left x;
    Right x -> Right (f x)
};

fmap1st f p = case p of {
    (l, r) -> (f l, r)
};

runParser p = case p of {
    Parser g -> g
};

(.) f g x = f (g x);
id x = x;

v = fmap id (Parser g);
x = fmap ((.) f g) (Parser g);
y = ((.) (fmap f) (fmap g)) (Parser g);