aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PursLoader/LoaderRef.js
diff options
context:
space:
mode:
authoreric thul <thul.eric@gmail.com>2015-08-11 20:57:07 -0400
committereric thul <thul.eric@gmail.com>2015-08-11 20:57:07 -0400
commit03b840cb5fb8ff5217fefc9e1240a3131db309fc (patch)
tree6183f4453aa15ad67ee0249fb8d35702cef5ecad /src/PursLoader/LoaderRef.js
parentfa01c5a4cb42d80ac147dc5ab512a0795dbe14da (diff)
downloadpurs-loader-03b840cb5fb8ff5217fefc9e1240a3131db309fc.tar.gz
purs-loader-03b840cb5fb8ff5217fefc9e1240a3131db309fc.tar.zst
purs-loader-03b840cb5fb8ff5217fefc9e1240a3131db309fc.zip
PureScript 0.7 updates and migration to pulp
Diffstat (limited to 'src/PursLoader/LoaderRef.js')
-rw-r--r--src/PursLoader/LoaderRef.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/PursLoader/LoaderRef.js b/src/PursLoader/LoaderRef.js
new file mode 100644
index 0000000..3ce0970
--- /dev/null
+++ b/src/PursLoader/LoaderRef.js
@@ -0,0 +1,56 @@
1'use strict';
2
3// module PursLoader.LoaderRef
4
5function asyncFn(isJust, fromMaybe, ref){
6 return function(){
7 var callback = ref.async();
8 return function(error){
9 return function(value){
10 return function(){
11 return isJust(error) ? callback(fromMaybe(new Error())(error))
12 : callback(null, value);
13 };
14 };
15 };
16 };
17}
18function cacheable(ref){
19 return function(){
20 return ref.cacheable && ref.cacheable();
21 };
22}
23
24function query(ref){
25 return ref.query;
26}
27
28function clearDependencies(ref){
29 return function(){
30 return ref.clearDependencies();
31 };
32}
33
34function resourcePath(ref){
35 return ref.resourcePath;
36}
37
38function addDependency(ref){
39 return function(dep){
40 return function(){
41 return ref.addDependency(dep);
42 };
43 };
44}
45
46exports.asyncFn = asyncFn;
47
48exports.cacheable = cacheable;
49
50exports.query = query;
51
52exports.clearDependencies = clearDependencies;
53
54exports.resourcePath = resourcePath;
55
56exports.addDependency = addDependency;