Skip to content

Commit abe5486

Browse files
committed
Move STArray functions into Data.Array.ST
1 parent cba046d commit abe5486

File tree

4 files changed

+53
-3
lines changed

4 files changed

+53
-3
lines changed

Gruntfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = function(grunt) {
1313

1414
pscMake: ["<%=libFiles%>"],
1515
dotPsci: ["<%=libFiles%>"],
16-
docgen: {
16+
pscDocs: {
1717
readme: {
1818
src: "src/**/*.purs",
1919
dest: "README.md"
@@ -25,6 +25,6 @@ module.exports = function(grunt) {
2525
grunt.loadNpmTasks("grunt-contrib-clean");
2626
grunt.loadNpmTasks("grunt-purescript");
2727

28-
grunt.registerTask("make", ["pscMake", "dotPsci", "docgen"]);
28+
grunt.registerTask("make", ["pscMake", "dotPsci", "pscDocs"]);
2929
grunt.registerTask("default", ["make"]);
3030
};

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@
112112
zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
113113

114114

115+
## Module Data.Array.ST
116+
117+
### Types
118+
119+
data STArray :: * -> * -> *
120+
121+
122+
### Values
123+
124+
115125
## Module Data.Array.Unsafe
116126

117127
### Values

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
"dependencies": {
44
"grunt": "~0.4.4",
55
"grunt-purescript": "~0.5.1",
6-
"grunt-contrib-clean": "~0.5.0"
6+
"grunt-contrib-clean": "~0.6.0"
77
}
88
}

src/Data/Array/ST.purs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
module Data.Array.ST
2+
( STArray(..)
3+
4+
) where
5+
6+
import Control.Monad.Eff
7+
import Control.Monad.ST (ST())
8+
9+
foreign import data STArray :: * -> * -> *
10+
11+
foreign import runSTArray """
12+
function runSTArray(f) {
13+
return f;
14+
}""" :: forall a r. (forall h. Eff (st :: ST h | r) (STArray h a)) -> Eff r [a]
15+
16+
foreign import emptySTArray """
17+
function emptySTArray() {
18+
return [];
19+
}""" :: forall a h r. Number -> a -> Eff (st :: ST h | r) (STArray h a)
20+
21+
foreign import peekSTArray """
22+
function peekSTArray(arr) {
23+
return function(i) {
24+
return function() {
25+
return arr[i];
26+
};
27+
};
28+
}""" :: forall a h r. STArray h a -> Number -> Eff (st :: ST h | r) a
29+
30+
foreign import pokeSTArray """
31+
function pokeSTArray(arr) {
32+
return function(i) {
33+
return function(a) {
34+
return function() {
35+
arr[i] = a;
36+
return {};
37+
};
38+
};
39+
};
40+
}""" :: forall a h r. STArray h a -> Number -> a -> Eff (st :: ST h | r) Unit

0 commit comments

Comments
 (0)