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 1111
1212### Type Class Instances
1313
14+ instance altList :: Alt List
15+
1416 instance alternativeList :: Alternative List
1517
1618 instance applicativeList :: Applicative List
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)
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
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
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ import Data.Foldable
4141import Data.Unfoldable
4242import Data.Traversable
4343
44+ import Control.Alt
45+ import Control.Plus
46+ import Control.Alternative
47+ import Control.MonadPlus
48+
4449data List a = Nil | Cons a (List a )
4550
4651instance showList :: (Show a ) => Show (List a ) where
@@ -115,10 +120,16 @@ instance bindList :: Bind List where
115120
116121instance 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+
122133fromArray :: forall a . [a ] -> List a
123134fromArray = foldr Cons Nil
124135
You can’t perform that action at this time.
0 commit comments