File tree Expand file tree Collapse file tree 4 files changed +17
-22
lines changed Expand file tree Collapse file tree 4 files changed +17
-22
lines changed Original file line number Diff line number Diff line change 18
18
" package.json"
19
19
],
20
20
"dependencies" : {
21
- "purescript-exists" : " ^2.0.0" ,
22
- "purescript-prelude" : " ^2.1.0" ,
23
- "purescript-newtype" : " ^1.1.0"
21
+ "purescript-exists" : " ^3.0.0" ,
22
+ "purescript-prelude" : " ^3.0.0" ,
23
+ "purescript-newtype" : " ^2.0.0" ,
24
+ "purescript-transformers" : " ^3.1.0"
24
25
}
25
26
}
Original file line number Diff line number Diff line change 2
2
"private" : true ,
3
3
"scripts" : {
4
4
"clean" : " rimraf output && rimraf .pulp-cache" ,
5
- "build" : " pulp build --censor-lib --strict"
5
+ "build" : " pulp build -- -- censor-lib --strict"
6
6
},
7
7
"devDependencies" : {
8
- "pulp" : " ^9 .0.1 " ,
9
- "purescript" : " ^0.10.1 " ,
10
- "purescript-psa" : " ^0.3.9 " ,
8
+ "pulp" : " ^11 .0.0 " ,
9
+ "purescript" : " ^0.11.0 " ,
10
+ "purescript-psa" : " ^0.5.0 " ,
11
11
"rimraf" : " ^2.5.4"
12
12
}
13
13
}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ module Data.Functor.Mu
2
2
( Mu (..)
3
3
, roll
4
4
, unroll
5
+ , transMu
5
6
) where
6
7
7
8
import Prelude
Original file line number Diff line number Diff line change 1
1
module Data.Functor.Nu
2
2
( Nu (..)
3
3
, NuF (..)
4
- , Store
5
4
, unfold
6
5
, observe
7
6
) where
8
7
9
8
import Prelude
10
9
import Data.Exists (Exists , mkExists , runExists )
11
10
import Data.Newtype (class Newtype )
12
-
13
- type Store s a =
14
- { pos :: s
15
- , peek :: s -> a
16
- }
11
+ import Data.Tuple (Tuple (..))
12
+ import Control.Comonad.Store (Store , store , runStore )
17
13
18
14
newtype NuF f a = NuF (Store a (f a ))
19
15
@@ -23,14 +19,11 @@ newtype Nu f = Nu (Exists (NuF f))
23
19
derive instance newtypeNu :: Newtype (Nu f ) _
24
20
25
21
unfold :: forall f a . a -> (a -> f a ) -> Nu f
26
- unfold pos peek =
27
- Nu $ mkExists $ NuF
28
- { pos : pos
29
- , peek : peek
30
- }
22
+ unfold pos peek = Nu $ mkExists $ NuF $ store peek pos
31
23
32
24
observe :: forall f . Functor f => Nu f -> f (Nu f )
33
- observe (Nu e) =
34
- runExists
35
- (\(NuF { peek, pos }) -> flip unfold peek <$> peek pos)
36
- e
25
+ observe (Nu e) = runExists observeF e
26
+
27
+ observeF :: forall f a . Functor f => NuF f a -> f (Nu f )
28
+ observeF (NuF x) = case runStore x of
29
+ (Tuple peek pos) -> flip unfold peek <$> peek pos
You can’t perform that action at this time.
0 commit comments