Skip to content

Commit d9962a5

Browse files
committed
Use unit
1 parent aaa86da commit d9962a5

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464
class Error a where
6565
noMsg :: a
66-
strMsg :: Prim.String -> a
66+
strMsg :: String -> a
6767

6868

6969
### Type Class Instances
@@ -142,7 +142,7 @@
142142
data Free f a where
143143
Pure :: a -> Free f a
144144
Free :: f (Free f a) -> Free f a
145-
Gosub :: forall s. (forall r. ({ } -> Free f r) -> (r -> Free f a) -> s) -> s -> Free f a
145+
Gosub :: forall s. (forall r. (Unit -> Free f r) -> (r -> Free f a) -> s) -> s -> Free f a
146146

147147

148148
### Type Classes
@@ -184,7 +184,7 @@
184184

185185
resume :: forall f a. (Functor f) => Free f a -> Either (f (Free f a)) a
186186

187-
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)
187+
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)
188188

189189

190190
## Module Control.Monad.Identity
@@ -385,9 +385,9 @@
385385

386386
gets :: forall s m a. (Monad m, MonadState s m) => (s -> a) -> m a
387387

388-
modify :: forall s m. (Monad m, MonadState s m) => (s -> s) -> m { }
388+
modify :: forall s m. (Monad m, MonadState s m) => (s -> s) -> m Unit
389389

390-
put :: forall m s. (Monad m, MonadState s m) => s -> m { }
390+
put :: forall m s. (Monad m, MonadState s m) => s -> m Unit
391391

392392

393393
## Module Control.Monad.State.Trans
@@ -443,7 +443,7 @@
443443
### Types
444444

445445
data Delay a where
446-
Delay :: { } -> a -> Delay a
446+
Delay :: Unit -> a -> Delay a
447447

448448
type Trampoline a = Free Delay a
449449

@@ -459,7 +459,7 @@
459459

460460
### Values
461461

462-
delay :: forall a. ({ } -> a) -> Trampoline a
462+
delay :: forall a. (Unit -> a) -> Trampoline a
463463

464464
done :: forall a. a -> Trampoline a
465465

@@ -521,7 +521,7 @@
521521

522522
listens :: forall w m a b. (Monoid w, Monad m, MonadWriter w m) => (w -> b) -> m a -> m (Tuple a b)
523523

524-
tell :: forall w m a. (Monoid w, Monad m, MonadWriter w m) => w -> m { }
524+
tell :: forall w m a. (Monoid w, Monad m, MonadWriter w m) => w -> m Unit
525525

526526

527527
## Module Control.Monad.Writer.Trans

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/State/Class.purs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ get = state \s -> Tuple s s
2020
gets :: forall s m a. (Monad m, MonadState s m) => (s -> a) -> m a
2121
gets f = state \s -> Tuple (f s) s
2222

23-
put :: forall m s. (Monad m, MonadState s m) => s -> m {}
24-
put s = state \_ -> Tuple {} s
23+
put :: forall m s. (Monad m, MonadState s m) => s -> m Unit
24+
put s = state \_ -> Tuple unit s
2525

26-
modify :: forall s m. (Monad m, MonadState s m) => (s -> s) -> m {}
27-
modify f = state \s -> Tuple {} (f s)
26+
modify :: forall s m. (Monad m, MonadState s m) => (s -> s) -> m Unit
27+
modify f = state \s -> Tuple unit (f s)
2828

2929
instance monadStateStateT :: (Monad m) => MonadState s (StateT s m) where
3030
state f = StateT $ return <<< f

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)

src/Control/Monad/Writer/Class.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class MonadWriter w m where
1616
listen :: forall a. m a -> m (Tuple a w)
1717
pass :: forall a. m (Tuple a (w -> w)) -> m a
1818

19-
tell :: forall w m a. (Monoid w, Monad m, MonadWriter w m) => w -> m {}
20-
tell w = writer $ Tuple {} w
19+
tell :: forall w m a. (Monoid w, Monad m, MonadWriter w m) => w -> m Unit
20+
tell w = writer $ Tuple unit w
2121

2222
listens :: forall w m a b. (Monoid w, Monad m, MonadWriter w m) => (w -> b) -> m a -> m (Tuple a b)
2323
listens f m = do

0 commit comments

Comments
 (0)