Skip to content

Commit 935dffe

Browse files
committed
Updating repository with latest changes to Free
As discussed in purescript/purescript-transformers#15
1 parent e710a4c commit 935dffe

File tree

5 files changed

+114
-16
lines changed

5 files changed

+114
-16
lines changed

.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
.DS_Store
2-
*.log
1+
.psci
32
node_modules
43
bower_components
5-
js
6-
externs
74
dist
8-
output

MODULE.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Module Documentation
2+
3+
## Module Control.Monad.Free
4+
5+
### Types
6+
7+
data Free f a where
8+
Pure :: a -> Free f a
9+
Free :: f (Free f a) -> Free f a
10+
Gosub :: forall s. (forall r. (Unit -> Free f r) -> (r -> Free f a) -> s) -> s -> Free f a
11+
12+
13+
### Type Classes
14+
15+
class MonadFree f m where
16+
wrap :: forall a. f (m a) -> m a
17+
18+
19+
### Type Class Instances
20+
21+
instance applicativeFree :: (Functor f) => Applicative (Free f)
22+
23+
instance applyFree :: (Functor f) => Apply (Free f)
24+
25+
instance bindFree :: (Functor f) => Bind (Free f)
26+
27+
instance functorFree :: (Functor f) => Functor (Free f)
28+
29+
instance monadFree :: (Functor f) => Monad (Free f)
30+
31+
instance monadFreeFree :: (Functor f) => MonadFree f (Free f)
32+
33+
instance monadTransFree :: MonadTrans Free
34+
35+
36+
### Values
37+
38+
go :: forall f a. (Functor f) => (f (Free f a) -> Free f a) -> Free f a -> a
39+
40+
goEff :: forall e f a. (Functor f) => (f (Free f a) -> Eff e (Free f a)) -> Free f a -> Eff e a
41+
42+
goM :: forall f m a. (Functor f, Monad m) => (f (Free f a) -> m (Free f a)) -> Free f a -> m a
43+
44+
iterM :: forall f m a. (Functor f, Monad m) => (forall a. f (m a) -> m a) -> Free f a -> m a
45+
46+
liftF :: forall f m a. (Functor f, Monad m, MonadFree f m) => f a -> m a
47+
48+
pureF :: forall f a. (Applicative f) => a -> Free f a
49+
50+
51+
## Module Control.Monad.Trampoline
52+
53+
### Types
54+
55+
newtype Delay a where
56+
Delay :: Unit -> a -> Delay a
57+
58+
type Trampoline a = Free Delay a
59+
60+
61+
### Type Class Instances
62+
63+
instance delayApplicative :: Applicative Delay
64+
65+
instance delayApply :: Apply Delay
66+
67+
instance delayFunctor :: Functor Delay
68+
69+
70+
### Values
71+
72+
delay :: forall a. (Unit -> a) -> Trampoline a
73+
74+
done :: forall a. a -> Trampoline a
75+
76+
runTrampoline :: forall a. Trampoline a -> a
77+
78+
suspend :: forall a. Trampoline a -> Trampoline a
79+
80+
81+

bower.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
"node_modules",
1111
"bower_components",
1212
"examples",
13-
"externs",
14-
"js",
1513
"dist"
1614
],
1715
"dependencies": {
18-
"purescript-transformers": "0.0.1",
19-
"purescript-either": "0.1.2"
16+
"purescript-transformers": "0.1.2",
17+
"purescript-either": "0.1.3"
2018
}
2119
}

gulpfile.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ var gulp = require('gulp')
33
, gutil = require('gulp-util')
44
, plumber = require('gulp-plumber')
55
, purescript = require('gulp-purescript')
6+
, sequence = require('run-sequence')
67
, config = {
7-
clean: ['dist', 'js', 'externs'],
8+
clean: ['dist'],
89
purescript: {
910
src: [
1011
'bower_components/purescript-*/src/**/*.purs*',
1112
'src/**/*.purs'
1213
],
1314
examples: 'examples/**/*.purs',
1415
dest: 'dist',
16+
docgen: 'MODULE.md',
1517
options: {
1618
main: 'Teletype'
1719
}
@@ -50,9 +52,29 @@ gulp.task('make', function(){
5052
);
5153
});
5254

55+
gulp.task('psci', function(){
56+
return (
57+
gulp.src(config.purescript.src).
58+
pipe(plumber()).
59+
pipe(purescript.dotPsci()).
60+
on('error', error)
61+
);
62+
});
63+
64+
gulp.task('docgen', function(){
65+
return (
66+
gulp.src(config.purescript.src[1]).
67+
pipe(plumber()).
68+
pipe(purescript.docgen()).
69+
on('error', error).
70+
pipe(gulp.dest(config.purescript.docgen))
71+
);
72+
});
5373

5474
gulp.task('watch', function(cb){
5575
gulp.watch(config.purescript.src, ['make']);
5676
});
5777

58-
gulp.task('default', ['clean', 'make'], function(){});
78+
gulp.task('default', function(){
79+
sequence('clean', 'make', ['psci', 'docgen']);
80+
});

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
"name": "purescript-free",
33
"private": true,
44
"devDependencies": {
5-
"gulp": "^3.5.5",
6-
"gulp-clean": "^0.2.4",
7-
"gulp-util": "^2.2.14",
8-
"gulp-plumber": "^0.5.6",
9-
"gulp-purescript": "^0.0.4"
5+
"gulp": "3.8.7",
6+
"gulp-clean": "0.2.4",
7+
"gulp-util": "2.2.14",
8+
"gulp-plumber": "0.5.6",
9+
"gulp-purescript": "0.0.10",
10+
"run-sequence": "0.3.6"
1011
}
1112
}

0 commit comments

Comments
 (0)