File tree Expand file tree Collapse file tree 2 files changed +32
-8
lines changed
Expand file tree Collapse file tree 2 files changed +32
-8
lines changed Original file line number Diff line number Diff line change 6060
6161### Type Classes
6262
63- class Lazy a where
64- defer :: (Unit -> a ) -> a
63+ class Lazy l where
64+ defer :: (Unit -> l ) -> l
6565
66- class Lazy1 a where
67- defer1 :: forall b. (Unit -> a b) -> a b
66+ class Lazy1 l where
67+ defer1 :: forall a. (Unit -> l a) -> l a
68+
69+ class Lazy2 l where
70+ defer2 :: forall a b. (Unit -> l a b) -> l a b
71+
72+
73+ ### Values
74+
75+ fix :: forall l a. (Lazy l) => (l -> l) -> l
76+
77+ fix1 :: forall l a. (Lazy1 l) => (l a -> l a) -> l a
78+
79+ fix2 :: forall l a b. (Lazy2 l) => (l a b -> l a b) -> l a b
6880
6981
7082## Module Control.Monad
Original file line number Diff line number Diff line change 11module Control.Lazy where
22
3- class Lazy a where
4- defer :: (Unit -> a ) -> a
3+ class Lazy l where
4+ defer :: (Unit -> l ) -> l
55
6- class Lazy1 a where
7- defer1 :: forall b . (Unit -> a b ) -> a b
6+ class Lazy1 l where
7+ defer1 :: forall a . (Unit -> l a ) -> l a
8+
9+ class Lazy2 l where
10+ defer2 :: forall a b . (Unit -> l a b ) -> l a b
11+
12+ fix :: forall l a . (Lazy l ) => (l -> l ) -> l
13+ fix f = defer (\_ -> f (fix f))
14+
15+ fix1 :: forall l a . (Lazy1 l ) => (l a -> l a ) -> l a
16+ fix1 f = defer1 (\_ -> f (fix1 f))
17+
18+ fix2 :: forall l a b . (Lazy2 l ) => (l a b -> l a b ) -> l a b
19+ fix2 f = defer2 (\_ -> f (fix2 f))
You can’t perform that action at this time.
0 commit comments