Skip to content

Commit 0c685ac

Browse files
garybethul
authored andcommitted
Use unit
1 parent 02d49df commit 0c685ac

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
# Deprecation Notice
22

33
Please note that this library has been merged into [purescript-transformers](https://github.com/purescript-contrib/purescript-transformers).
4-
5-
Development will be continued there.

src/Control/Monad/Free.purs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Data.Either
66

77
data Free f a = Pure a
88
| Free (f (Free f a))
9-
| Gosub (forall s. (forall r. ({} -> Free f r) -> (r -> Free f a) -> s) -> s)
9+
| Gosub (forall s. (forall r. (Unit -> Free f r) -> (r -> Free f a) -> s) -> s)
1010

1111
class MonadFree f m where
1212
wrap :: forall a. f (m a) -> m a
@@ -45,20 +45,20 @@ pureF a = Free (pure (Pure a))
4545
iterM :: forall f m a. (Functor f, Monad m) => (forall a. f (m a) -> m a) -> Free f a -> m a
4646
iterM _ (Pure a) = return a
4747
iterM k (Free f) = k $ iterM k <$> f
48-
iterM k (Gosub f) = f (\req recv -> iterM k (req {}) >>= (iterM k <<< recv))
48+
iterM k (Gosub f) = f (\req recv -> iterM k (req unit) >>= (iterM k <<< recv))
4949

5050
-- Note: can blow the stack!
5151
goM :: forall f m a. (Functor f, Monad m) => (f (Free f a) -> m (Free f a)) -> Free f a -> m a
5252
goM k f = case resume f of
5353
Left s -> k s >>= goM k
5454
Right a -> return a
5555

56-
resumeGosub :: forall f a. (Functor f) => (forall s. (forall r. ({} -> Free f r) -> (r -> Free f a) -> s) -> s) -> Either (f (Free f a)) (Free f a)
56+
resumeGosub :: forall f a. (Functor f) => (forall s. (forall r. (Unit -> Free f r) -> (r -> Free f a) -> s) -> s) -> Either (f (Free f a)) (Free f a)
5757
resumeGosub f = f (\a g ->
58-
case a {} of
58+
case a unit of
5959
Pure a -> Right (g a)
6060
Free t -> Left ((\h -> h >>= g) <$> t)
61-
Gosub h -> Right (h (\b i -> b {} >>= (\x -> i x >>= g)))
61+
Gosub h -> Right (h (\b i -> b unit >>= (\x -> i x >>= g)))
6262
)
6363

6464
foreign import resume

src/Control/Monad/Trampoline.purs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ module Control.Monad.Trampoline where
22

33
import Control.Monad.Free
44

5-
data Delay a = Delay ({} -> a)
5+
data Delay a = Delay (Unit -> a)
66

77
instance delayFunctor :: Functor Delay where
8-
(<$>) f (Delay g) = Delay (const (f (g {})))
8+
(<$>) f (Delay g) = Delay (const (f (g unit)))
99

1010
instance delayApply :: Apply Delay where
11-
(<*>) (Delay f) (Delay a) = Delay (\{} -> (f {}) (a {}))
11+
(<*>) (Delay f) (Delay a) = Delay (\_ -> (f unit) (a unit))
1212

1313
instance delayApplicative :: Applicative Delay where
14-
pure a = Delay (\{} -> a)
14+
pure a = Delay (const a)
1515

1616
type Trampoline a = Free Delay a
1717

1818
done :: forall a. a -> Trampoline a
1919
done = Pure
2020

2121
suspend :: forall a. Trampoline a -> Trampoline a
22-
suspend a = Free (Delay (\{} -> a))
22+
suspend a = Free (Delay (const a))
2323

24-
delay :: forall a. ({} -> a) -> Trampoline a
24+
delay :: forall a. (Unit -> a) -> Trampoline a
2525
delay a = Free (done <$> Delay a)
2626

2727
runTrampoline :: forall a. Trampoline a -> a
28-
runTrampoline = go (\(Delay f) -> f {})
28+
runTrampoline = go (\(Delay f) -> f unit)

0 commit comments

Comments
 (0)