Skip to content

Commit f4cd493

Browse files
committed
Update for new control modules
1 parent 0a84fd3 commit f4cd493

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
### Type Class Instances
1313

14+
instance altList :: Alt List
15+
1416
instance alternativeList :: Alternative List
1517

1618
instance applicativeList :: Applicative List
@@ -27,10 +29,14 @@
2729

2830
instance monadList :: Monad List
2931

32+
instance monadPlusList :: MonadPlus List
33+
3034
instance monoidList :: Monoid (List a)
3135

3236
instance ordList :: (Ord a) => Ord (List a)
3337

38+
instance plusList :: Plus List
39+
3440
instance semigroupList :: Semigroup (List a)
3541

3642
instance showList :: (Show a) => Show (List a)
@@ -76,6 +82,10 @@
7682

7783
insertBy :: forall a. (a -> a -> Ordering) -> a -> List a -> List a
7884

85+
intersect :: forall a. (Eq a) => List a -> List a -> List a
86+
87+
intersectBy :: forall a. (a -> a -> Boolean) -> List a -> List a -> List a
88+
7989
last :: forall a. List a -> Maybe a
8090

8191
length :: forall a. List a -> Number
@@ -98,6 +108,10 @@
98108

99109
toArray :: forall a. List a -> [a]
100110

111+
union :: forall a. (Eq a) => List a -> List a -> List a
112+
113+
unionBy :: forall a. (a -> a -> Boolean) -> List a -> List a -> List a
114+
101115
zipWith :: forall a b c. (a -> b -> c) -> List a -> List b -> List c
102116

103117

src/Data/List.purs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ import Data.Foldable
4141
import Data.Unfoldable
4242
import Data.Traversable
4343

44+
import Control.Alt
45+
import Control.Plus
46+
import Control.Alternative
47+
import Control.MonadPlus
48+
4449
data List a = Nil | Cons a (List a)
4550

4651
instance showList :: (Show a) => Show (List a) where
@@ -115,10 +120,16 @@ instance bindList :: Bind List where
115120

116121
instance monadList :: Monad List
117122

118-
instance alternativeList :: Alternative List where
119-
empty = Nil
123+
instance altList :: Alt List where
120124
(<|>) = (<>)
121125

126+
instance plusList :: Plus List where
127+
empty = Nil
128+
129+
instance alternativeList :: Alternative List
130+
131+
instance monadPlusList :: MonadPlus List
132+
122133
fromArray :: forall a. [a] -> List a
123134
fromArray = foldr Cons Nil
124135

0 commit comments

Comments
 (0)