File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,11 @@ module Web.File.FileList
77
88import Prelude
99
10- import Data.Maybe (Maybe (..) )
10+ import Data.Maybe (Maybe )
1111import Data.Nullable (Nullable , toMaybe )
12- import Data.Array (snoc )
1312import Data.Tuple (Tuple (..))
1413import Web.File.File (File )
14+ import Data.Unfoldable (unfoldr )
1515
1616foreign import data FileList :: Type
1717
@@ -25,10 +25,5 @@ item :: Int -> FileList -> Maybe File
2525item i = toMaybe <<< _item i
2626
2727items :: FileList -> Array File
28- items fl = untilNothing (\c fs -> Tuple (c + 1 ) <<< snoc fs <$> item c fl) 0 mempty
29-
30- untilNothing :: forall a b . (a -> b -> Maybe (Tuple a b )) -> a -> b -> b
31- untilNothing f x y = let m = f x y in
32- case m of (Just (Tuple x' y')) -> untilNothing f x' y'
33- Nothing -> y
28+ items fl = unfoldr (\i -> (flip Tuple (i + 1 )) <$> item i fl) 0
3429
You can’t perform that action at this time.
0 commit comments