File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 11module Main where
22
3+ import Prelude
4+
35import Data.Tuple
46import Data.Maybe
57import Data.Array
@@ -8,7 +10,7 @@ import Data.Int
810
911import Console
1012
11- collatz :: Int -> [ Int ]
13+ collatz :: Int -> Array Int
1214collatz = unfoldr step
1315 where
1416 step n | n == one = Nothing
Original file line number Diff line number Diff line change 66
77module Data.Unfoldable where
88
9+ import Prelude
10+
911import Data.Maybe
1012import Data.Tuple
1113import Data.Array.ST
@@ -23,7 +25,7 @@ import Control.Monad.ST
2325class Unfoldable t where
2426 unfoldr :: forall a b . (b -> Maybe (Tuple a b )) -> b -> t a
2527
26- instance unfoldableArray :: Unfoldable [] where
28+ instance unfoldableArray :: Unfoldable Array where
2729 unfoldr f b = runPure (runSTArray (do
2830 arr <- emptySTArray
2931 seed <- newSTRef b
You can’t perform that action at this time.
0 commit comments