git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Move unsafe array functions to new module
48c8527Gary Burgess
prelude/prelude.purs+14−12
@@ -487,19 +487,13 @@ module Data.Array where
487 import Prelude
487 import Prelude
488 import Data.Maybe
488 import Data.Maybe
489
489
490− head :: forall a. [a] -> a
490+ head :: forall a. [a] -> Maybe a
491− head (x : _) = x
492−
493− headSafe :: forall a. [a] -> Maybe a
494− headSafe (x : _) = Just x
491+ head (x : _) = Just x
495− headSafe _ = Nothing
492+ head _ = Nothing
496−
497− tail :: forall a. [a] -> [a]
498− tail (_ : xs) = xs
499
493
500− tailSafe :: forall a. [a] -> Maybe [a]
494+ tail :: forall a. [a] -> Maybe [a]
501− tailSafe (_ : xs) = Just xs
495+ tail (_ : xs) = Just xs
502− tailSafe _ = Nothing
496+ tail _ = Nothing
503
497
504 map :: forall a b. (a -> b) -> [a] -> [b]
498 map :: forall a b. (a -> b) -> [a] -> [b]
505 map _ [] = []
499 map _ [] = []
@@ -644,6 +638,14 @@ module Data.Array where
644 instance Prelude.Alternative [] where
638 instance Prelude.Alternative [] where
645 empty = []
639 empty = []
646 (<|>) = concat
640 (<|>) = concat
641+
642+module Data.Array.Unsafe where
643+
644+ head :: forall a. [a] -> a
645+ head (x : _) = x
646+
647+ tail :: forall a. [a] -> [a]
648+ tail (_ : xs) = xs
647
649
648module Data.Tuple where
650module Data.Tuple where
649
651