Skip to content

Commit c3fd30b

Browse files
authored
Merge pull request #7 from safareli/ps11
Update for PureScript 0.11
2 parents b9be0a7 + a20cbe3 commit c3fd30b

File tree

4 files changed

+17
-22
lines changed

4 files changed

+17
-22
lines changed

bower.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
"package.json"
1919
],
2020
"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"
2425
}
2526
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"private": true,
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "pulp build --censor-lib --strict"
5+
"build": "pulp build -- --censor-lib --strict"
66
},
77
"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",
1111
"rimraf": "^2.5.4"
1212
}
1313
}

src/Data/Functor/Mu.purs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module Data.Functor.Mu
22
( Mu(..)
33
, roll
44
, unroll
5+
, transMu
56
) where
67

78
import Prelude

src/Data/Functor/Nu.purs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
module Data.Functor.Nu
22
( Nu(..)
33
, NuF(..)
4-
, Store
54
, unfold
65
, observe
76
) where
87

98
import Prelude
109
import Data.Exists (Exists, mkExists, runExists)
1110
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)
1713

1814
newtype NuF f a = NuF (Store a (f a))
1915

@@ -23,14 +19,11 @@ newtype Nu f = Nu (Exists (NuF f))
2319
derive instance newtypeNu :: Newtype (Nu f) _
2420

2521
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
3123

3224
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

0 commit comments

Comments
 (0)