File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ module Data.List.NonEmpty
77 , singleton
88 , length
99 , cons
10+ , cons'
1011 , snoc
12+ , snoc'
1113 , head
1214 , last
1315 , tail
@@ -128,9 +130,16 @@ singleton = NonEmptyList <<< NE.singleton
128130cons :: forall a . a -> NonEmptyList a -> NonEmptyList a
129131cons y (NonEmptyList (x :| xs)) = NonEmptyList (y :| x : xs)
130132
133+ cons' :: forall a . a -> L.List a -> NonEmptyList a
134+ cons' x xs = NonEmptyList (x :| xs)
135+
131136snoc :: forall a . NonEmptyList a -> a -> NonEmptyList a
132137snoc (NonEmptyList (x :| xs)) y = NonEmptyList (x :| L .snoc xs y)
133138
139+ snoc' :: forall a . L.List a -> a -> NonEmptyList a
140+ snoc' (x : xs) y = NonEmptyList (x :| L .snoc xs y)
141+ snoc' L.Nil y = singleton y
142+
134143head :: forall a . NonEmptyList a -> a
135144head (NonEmptyList (x :| _)) = x
136145
You can’t perform that action at this time.
0 commit comments