Skip to content

Commit 6428355

Browse files
committed
Naming scheme for effects
Each effect type is typically named using the prefix Ng followed by the name of the service; e.g., NgHttp. The label for the effect is the same, except in lowercase; e.g., nghttp.
1 parent baacf92 commit 6428355

File tree

17 files changed

+508
-443
lines changed

17 files changed

+508
-443
lines changed

MODULE.md

Lines changed: 192 additions & 171 deletions
Large diffs are not rendered by default.

examples/Todomvc/Escape.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Todomvc.Escape (EscapeDirective(), escape) where
33
import Data.Maybe
44

55
import Angular.Attributes (get)
6-
import Angular.Element (El(..), on)
6+
import Angular.Element (on)
77
import Angular.Scope (apply, stringApplyExpr)
88

99
foreign import data EscapeDirective :: *

examples/Todomvc/Focus.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Control.Monad.Eff
66

77
import qualified DOM.Node as D
88

9-
import Angular.Attributes (Attr(), get)
9+
import Angular.Attributes (get)
1010
import Angular.Element ((!!))
1111
import Angular.Scope (watch, apply, applyExpr)
1212

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ gulp.task('watch.todomvc', function(cb){
100100
server(cb);
101101
});
102102

103-
gulp.task('default', ['clean', 'make', 'docgen']);
103+
gulp.task('default', ['clean', 'make', 'docgen', 'psci']);

src/Angular/Attributes.purs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Angular.Attributes
22
( Attributes()
3-
, Attr()
3+
, NgAttr()
4+
, AttrEff()
45
, addClass
56
, removeClass
67
, updateClass
@@ -14,7 +15,9 @@ import Control.Monad.Eff
1415

1516
foreign import data Attributes :: *
1617

17-
foreign import data Attr :: !
18+
foreign import data NgAttr :: !
19+
20+
type AttrEff e r = Eff (ngattr :: NgAttr | e) r
1821

1922
foreign import addClass
2023
" function addClass(classVal){ \
@@ -24,7 +27,7 @@ foreign import addClass
2427
\ }; \
2528
\ }; \
2629
\ }"
27-
:: forall e. String -> Attributes -> Eff (ngattr :: Attr | e) Unit
30+
:: forall e. String -> Attributes -> AttrEff e Unit
2831

2932
foreign import removeClass
3033
" function removeClass(classVal){ \
@@ -34,7 +37,7 @@ foreign import removeClass
3437
\ }; \
3538
\ }; \
3639
\ }"
37-
:: forall e. String -> Attributes -> Eff (ngattr :: Attr | e) Unit
40+
:: forall e. String -> Attributes -> AttrEff e Unit
3841

3942
foreign import updateClass
4043
" function updateClass(newClasses){ \
@@ -46,7 +49,7 @@ foreign import updateClass
4649
\ }; \
4750
\ }; \
4851
\ }"
49-
:: forall e. String -> String -> Attributes -> Eff (ngattr :: Attr | e) Unit
52+
:: forall e. String -> String -> Attributes -> AttrEff e Unit
5053

5154
foreign import observe
5255
" function observe(key){ \
@@ -58,7 +61,7 @@ foreign import observe
5861
\ }; \
5962
\ }; \
6063
\ }"
61-
:: forall e f. String -> (String -> Eff f Unit) -> Attributes -> Eff (ngattr :: Attr | e) Unit
64+
:: forall e f. String -> (String -> Eff f Unit) -> Attributes -> AttrEff e Unit
6265

6366
foreign import set
6467
" function set(name){ \
@@ -70,20 +73,20 @@ foreign import set
7073
\ }; \
7174
\ }; \
7275
\ }"
73-
:: forall e. String -> String -> Attributes -> Eff (ngattr :: Attr | e) Unit
76+
:: forall e. String -> String -> Attributes -> AttrEff e Unit
7477

7578
foreign import get
7679
" function get(attrs){ \
7780
\ return function(){ \
7881
\ return attrs; \
7982
\ }; \
8083
\ }"
81-
:: forall e a. Attributes -> Eff (ngattr :: Attr | e) { | a }
84+
:: forall e a. Attributes -> AttrEff e { | a }
8285

8386
foreign import attr
8487
" function attr(attrs){ \
8588
\ return function(){ \
8689
\ return attrs.$attr; \
8790
\ }; \
8891
\ }"
89-
:: forall e a. Attributes -> Eff (ngattr :: Attr | e) { | a }
92+
:: forall e a. Attributes -> AttrEff e { | a }

src/Angular/Cache.purs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
module Angular.Cache
22
( Cache()
33
, CacheFactory()
4-
, CACHE()
4+
, CacheEff()
5+
, NgCache()
56
, Key()
67
, Name()
78
, Options()
@@ -18,7 +19,7 @@ import Control.Monad.Eff
1819
import Data.Maybe
1920
import Data.Function
2021

21-
foreign import data CACHE :: !
22+
foreign import data NgCache :: !
2223

2324
foreign import data Cache :: *
2425

@@ -30,7 +31,9 @@ type Name = String
3031

3132
type Options a = { capacity :: Number | a }
3233

33-
cache :: forall e a. Name -> Maybe (Options a) -> CacheFactory -> Eff (ngcache :: CACHE | e) Cache
34+
type CacheEff e r = Eff (ngcache :: NgCache | e) r
35+
36+
cache :: forall e a. Name -> Maybe (Options a) -> CacheFactory -> CacheEff e Cache
3437
cache = runFn4 cacheFn fromMaybe
3538

3639
foreign import cacheFn
@@ -43,7 +46,7 @@ foreign import cacheFn
4346
Name
4447
(Maybe (Options a))
4548
CacheFactory
46-
(Eff (ngcache :: CACHE | e) Cache)
49+
(CacheEff e Cache)
4750

4851
foreign import put
4952
" function put(key){ \
@@ -55,7 +58,7 @@ foreign import put
5558
\ }; \
5659
\ }; \
5760
\ } "
58-
:: forall e a. Key -> a -> Cache -> Eff (ngcache :: CACHE | e) a
61+
:: forall e a. Key -> a -> Cache -> CacheEff e a
5962

6063
foreign import get
6164
" function get(key){ \
@@ -65,7 +68,7 @@ foreign import get
6568
\ }; \
6669
\ }; \
6770
\ } "
68-
:: forall e a. Key -> Cache -> Eff (ngcache :: CACHE | e) a
71+
:: forall e a. Key -> Cache -> CacheEff e a
6972

7073
foreign import remove
7174
" function remove(key){ \
@@ -75,28 +78,28 @@ foreign import remove
7578
\ }; \
7679
\ }; \
7780
\ } "
78-
:: forall e a. Key -> Cache -> Eff (ngcache :: CACHE | e) Unit
81+
:: forall e. Key -> Cache -> CacheEff e Unit
7982

8083
foreign import removeAll
8184
" function removeAll(cache){ \
8285
\ return function(){ \
8386
\ return cache.removeAll(); \
8487
\ }; \
8588
\ } "
86-
:: forall e. Cache -> Eff (ngcache :: CACHE | e) Unit
89+
:: forall e. Cache -> CacheEff e Unit
8790

8891
foreign import destroy
8992
" function destroy(cache){ \
9093
\ return function(){ \
9194
\ return cache.destroy(); \
9295
\ }; \
9396
\ } "
94-
:: forall e. Cache -> Eff (ngcache :: CACHE | e) Unit
97+
:: forall e. Cache -> CacheEff e Unit
9598

9699
foreign import info
97100
" function info(cache){ \
98101
\ return function(){ \
99102
\ return cache.info(); \
100103
\ }; \
101104
\ } "
102-
:: forall e a. Cache -> Eff (ngcache :: CACHE | e) { id :: String, size :: Number | a }
105+
:: forall e a. Cache -> CacheEff e { id :: String, size :: Number | a }

0 commit comments

Comments
 (0)