Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions spago.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
, "partial"
, "prelude"
, "quickcheck"
, "unfoldable"
, "unsafe-coerce"
]
, packages = ./packages.dhall
Expand Down
7 changes: 6 additions & 1 deletion src/Data/Array/AtLeast.purs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,16 @@ import Data.FastVect.FastVect as FV
import Data.Foldable (class Foldable)
import Data.FoldableWithIndex (class FoldableWithIndex)
import Data.FunctorWithIndex (class FunctorWithIndex)
import Data.Int.AtLeast (fromLength) as IntAL
import Data.Int.AtLeast (IntAL, fromInt', toInt)
import Data.Int.AtLeast (fromLength) as IntAL
import Data.Maybe (Maybe(Nothing, Just), fromJust)
import Data.Reflectable (class Reflectable, reflectType)
import Data.Semigroup.Foldable (class Foldable1)
import Data.Semigroup.Foldable as Foldable1
import Data.Traversable (class Traversable)
import Data.TraversableWithIndex (class TraversableWithIndex)
import Data.Unfoldable (unfoldr1)
import Data.Unfoldable1 (class Unfoldable1)
import Partial.Unsafe (unsafePartial)
import Prim.Int (class Add, class Compare, class Mul)
import Prim.Ordering (EQ, GT, LT)
Expand Down Expand Up @@ -112,6 +114,9 @@ instance Compare n 0 GT => Foldable1 (ArrayAL n) where
foldr1 f xs = Foldable1.foldr1 f $ toNonEmptyArray xs
foldl1 f xs = Foldable1.foldl1 f $ toNonEmptyArray xs

instance Unfoldable1 (ArrayAL 1) where
unfoldr1 f = fromNonEmptyArray <<< unfoldr1 f

instance Apply (ArrayAL n) where
apply (ArrayAL fab) (ArrayAL a) = ArrayAL (Array.zipWith ($) fab a)

Expand Down