Hoogle Search
Within LTS Haskell 24.28 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
ihaskell IHaskellPrelude reverse xs returns the elements of xs in reverse order. xs must be finite.
Laziness
reverse is lazy in its elements.>>> head (reverse [undefined, 1]) 1
>>> reverse (1 : 2 : undefined) *** Exception: Prelude.undefined
Examples
>>> reverse [] []
>>> reverse [42] [42]
>>> reverse [2,5,7] [7,5,2]
>>> reverse [1..] * Hangs forever *
-
incipit-base Incipit.Base reverse xs returns the elements of xs in reverse order. xs must be finite.
Laziness
reverse is lazy in its elements.>>> head (reverse [undefined, 1]) 1
>>> reverse (1 : 2 : undefined) *** Exception: Prelude.undefined
Examples
>>> reverse [] []
>>> reverse [42] [42]
>>> reverse [2,5,7] [7,5,2]
>>> reverse [1..] * Hangs forever *
reverse :: Boundary PitchChannel v -> Maybe (Boundary PitchChannel v)reactive-midyim Reactive.Banana.MIDI.Note Swap order of keys. Non-note events are returned without modification. If by reversing a note leaves the range of representable MIDI notes, then we return Nothing.
reverse :: SymVal a => SList a -> SList asbv Data.SBV.List reverse s reverses the sequence. NB. We can define reverse in terms of foldl as: foldl (soFar elt -> singleton elt ++ soFar) [] But in my experiments, I found that this definition performs worse instead of the recursive definition SBV generates for reverse calls. So we're keeping it intact.
>>> sat $ \(l :: SList Integer) -> reverse l .== literal [3, 2, 1] Satisfiable. Model: s0 = [1,2,3] :: [Integer] >>> prove $ \(l :: SList Word32) -> reverse l .== [] .<=> null l Q.E.D.
-
sbv Data.SBV.String reverse s reverses the string. >>> sat $ s -> reverse s .== "abc" Satisfiable. Model: s0 = "cba" :: String >>> prove $ s -> reverse s .== "" .= null s Q.E.D.
reverse :: forall (m :: Type -> Type) a . Monad m => Stream m a -> Stream m astreamly-core Streamly.Data.Stream Returns the elements of the stream in reverse order. The stream must be finite. Note that this necessarily buffers the entire stream in memory. Definition:
>>> reverse m = Stream.concatEffect $ Stream.fold Fold.toListRev m >>= return . Stream.fromList
reverse :: forall (m :: Type -> Type) a . StreamK m a -> StreamK m astreamly-core Streamly.Data.StreamK No documentation available.
reverse :: (MonadIO m, Unbox a) => MutArray a -> m ()streamly-core Streamly.Internal.Data.MutArray You may not need to reverse an array because you can consume it in reverse using readerRev. To reverse large arrays you can read in reverse and write to another array. However, in-place reverse can be useful to take adavantage of cache locality and when you do not want to allocate additional memory.
reverse :: forall (m :: Type -> Type) a . Monad m => Stream m a -> Stream m astreamly-core Streamly.Internal.Data.Stream Returns the elements of the stream in reverse order. The stream must be finite. Note that this necessarily buffers the entire stream in memory. Definition:
>>> reverse m = Stream.concatEffect $ Stream.fold Fold.toListRev m >>= return . Stream.fromList
reverse :: forall (m :: Type -> Type) a . StreamK m a -> StreamK m astreamly-core Streamly.Internal.Data.StreamK No documentation available.