File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 11
11
12
12
### Type Class Instances
13
13
14
+ instance altList :: Alt List
15
+
14
16
instance alternativeList :: Alternative List
15
17
16
18
instance applicativeList :: Applicative List
27
29
28
30
instance monadList :: Monad List
29
31
32
+ instance monadPlusList :: MonadPlus List
33
+
30
34
instance monoidList :: Monoid (List a)
31
35
32
36
instance ordList :: (Ord a) => Ord (List a)
33
37
38
+ instance plusList :: Plus List
39
+
34
40
instance semigroupList :: Semigroup (List a)
35
41
36
42
instance showList :: (Show a) => Show (List a)
76
82
77
83
insertBy :: forall a. (a -> a -> Ordering) -> a -> List a -> List a
78
84
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
+
79
89
last :: forall a. List a -> Maybe a
80
90
81
91
length :: forall a. List a -> Number
98
108
99
109
toArray :: forall a. List a -> [a]
100
110
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
+
101
115
zipWith :: forall a b c. (a -> b -> c) -> List a -> List b -> List c
102
116
103
117
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ import Data.Foldable
41
41
import Data.Unfoldable
42
42
import Data.Traversable
43
43
44
+ import Control.Alt
45
+ import Control.Plus
46
+ import Control.Alternative
47
+ import Control.MonadPlus
48
+
44
49
data List a = Nil | Cons a (List a )
45
50
46
51
instance showList :: (Show a ) => Show (List a ) where
@@ -115,10 +120,16 @@ instance bindList :: Bind List where
115
120
116
121
instance monadList :: Monad List
117
122
118
- instance alternativeList :: Alternative List where
119
- empty = Nil
123
+ instance altList :: Alt List where
120
124
(<|>) = (<>)
121
125
126
+ instance plusList :: Plus List where
127
+ empty = Nil
128
+
129
+ instance alternativeList :: Alternative List
130
+
131
+ instance monadPlusList :: MonadPlus List
132
+
122
133
fromArray :: forall a . [a ] -> List a
123
134
fromArray = foldr Cons Nil
124
135
You can’t perform that action at this time.
0 commit comments