@@ -122,7 +122,7 @@ push = Native.Array.push
123{-| Get the element at a particular index.
123{-| Get the element at a particular index.
125− getOrFail 2 (A.fromList [3,2,1]) == 1
125+ getOrFail 0 (A.fromList [0,1,2]) == 0
127Warning: this function will result in a runtime error if the index is not found,
127Warning: this function will result in a runtime error if the index is not found,
128so it is best to use `get` or `getOrElse` unless you are sure the index will be
128so it is best to use `get` or `getOrElse` unless you are sure the index will be
@@ -133,9 +133,10 @@ getOrFail = Native.Array.get
134{-| Return Just the element at the index or Nothing if the index is out of range.
134{-| Return Just the element at the index or Nothing if the index is out of range.
136− get 2 (fromList [3,2,1]) == Just 2
136+ get 0 (fromList [0,1,2]) == Just 0
137+ get 2 (fromList [0,1,2]) == Just 2
137− get 5 (fromList [3,2,1]) == Nothing
138+ get 5 (fromList [0,1,2]) == Nothing
138− get -1 (fromList [3,2,1]) == Nothing
139+ get -1 (fromList [0,1,2]) == Nothing
140get : Int -> Array a -> Maybe a
141get : Int -> Array a -> Maybe a
141get i array =
142get i array =
@@ -146,8 +147,8 @@ get i array =
146{-| Get the element at the index. Or if the index is out of range, a default
147{-| Get the element at the index. Or if the index is out of range, a default
147value is returned.
148value is returned.
149− getOrElse 0 2 (fromList [3,2,1]) == 1
150+ getOrElse 0 2 (fromList [0,1,2]) == 2
150− getOrElse 0 5 (fromList [3,2,1]) == 0
151+ getOrElse 0 5 (fromList [0,1,2]) == 0
152getOrElse : a -> Int -> Array a -> a
153getOrElse : a -> Int -> Array a -> a
153getOrElse default i array =
154getOrElse default i array =