Skip to content

Commit 924de3d

Browse files
committed
some fixes
1 parent b2026e0 commit 924de3d

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

ITMOPrelude/Categories.hs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ import ITMOPrelude.Primitive
55
import ITMOPrelude.List
66
import ITMOPrelude.Tree
77

8-
-- class Category cat where
9-
-- id :: cat a a
10-
-- (.) :: cat b c -> cat a b -> cat a c
11-
8+
class Category cat where
9+
id :: cat a a
10+
(.) :: cat b c -> cat a b -> cat a c
11+
12+
instance Category (->) where
13+
id = \x -> x
14+
f . g = \x -> f (g x)
1215

1316
class Functor f where
1417
fmap :: (a -> b) -> f a -> f b
@@ -63,6 +66,4 @@ newtype State s a = State { runState :: s -> (s, a) }
6366
instance Monad (State s) where
6467
return a = State $ \s -> (s, a)
6568
ma >>= f = State $ \s -> let (s', a) = runState ma s
66-
in runState (f a) s'
67-
68-
69+
in runState (f a) s'

ITMOPrelude/IO.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{-# LANGUAGE NoImplicitPrelude #-}
22
module ITMOPrelude.IO where
33

4-
import ITMOPrelude.Primitive
4+
import ITMOPrelude.Primitive hiding ((.))
55
import ITMOPrelude.List
66
import ITMOPrelude.Categories
77

@@ -14,12 +14,10 @@ type IO a = State RealWorld a
1414

1515
getNat :: IO Nat
1616
getNat = State getNat'
17-
where getNat' world = (newWorld, value)
17+
where getNat' world = (newWorld, value)
1818
where newWorld = RealWorld (tail . stdIn $ world) (stdOut world) (exitCode world)
1919
value = head . stdIn $ world
2020

21-
22-
2321
putNat :: Nat -> IO ()
2422
putNat n = State putNat'
2523
where putNat' world = (newWorld, ())

0 commit comments

Comments
 (0)