Skip to content

Commit 4fe2736

Browse files
committed
Merge pull request #12 from purescript/alternative
Add Alt, Plus, MonadPlus, update Alternative
2 parents cb1b51c + 57f37ec commit 4fe2736

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Type Class Instances
66

7+
instance altArray :: Alt Prim.Array
8+
79
instance alternativeArray :: Alternative Prim.Array
810

911
instance applicativeArray :: Applicative Prim.Array
@@ -16,6 +18,10 @@
1618

1719
instance monadArray :: Monad Prim.Array
1820

21+
instance monadPlusArray :: MonadPlus Prim.Array
22+
23+
instance plusArray :: Plus Prim.Array
24+
1925
instance semigroupArray :: Semigroup [a]
2026

2127

bower.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"package.json"
1919
],
2020
"dependencies": {
21-
"purescript-maybe": "*"
21+
"purescript-maybe": "~0.2.0",
22+
"purescript-control": "~0.2.0"
2223
}
2324
}

src/Data/Array.purs

+12-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ module Data.Array
4242
, span
4343
) where
4444

45+
import Control.Alt
46+
import Control.Plus
47+
import Control.Alternative
48+
import Control.MonadPlus
4549
import Data.Maybe
4650
import Prelude.Unsafe (unsafeIndex)
4751

@@ -363,6 +367,12 @@ instance monadArray :: Monad []
363367
instance semigroupArray :: Semigroup [a] where
364368
(<>) = append
365369

366-
instance alternativeArray :: Alternative [] where
367-
empty = []
370+
instance altArray :: Alt [] where
368371
(<|>) = append
372+
373+
instance plusArray :: Plus [] where
374+
empty = []
375+
376+
instance alternativeArray :: Alternative []
377+
378+
instance monadPlusArray :: MonadPlus []

0 commit comments

Comments
 (0)