{-# LANGUAGE Rank2Types, MagicHash, UnboxedTuples, ExistentialQuantification #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
module Data.Generics.Uniplate.Internal.Utils(
unsafeCoerce, builder, unsafePerformIO, inlinePerformIO, concatCont, SPEC(SPEC)
) where
import System.IO.Unsafe(unsafePerformIO)
import Unsafe.Coerce(unsafeCoerce)
import GHC.Exts(build, realWorld#)
import GHC.IO(IO(IO))
import GHC.Types(SPEC(..))
{-# INLINE builder #-}
builder :: forall a . (forall b . (a -> b -> b) -> b -> b) -> [a]
builder :: forall a. (forall b. (a -> b -> b) -> b -> b) -> [a]
builder = (forall b. (a -> b -> b) -> b -> b) -> [a]
forall a. (forall b. (a -> b -> b) -> b -> b) -> [a]
build
{-# INLINE inlinePerformIO #-}
inlinePerformIO :: IO a -> a
inlinePerformIO :: forall a. IO a -> a
inlinePerformIO (IO State# RealWorld -> (# State# RealWorld, a #)
m) = case State# RealWorld -> (# State# RealWorld, a #)
m State# RealWorld
realWorld# of (# State# RealWorld
_, a
r #) -> a
r
{-# INLINE concatCont #-}
concatCont :: [a -> a] -> a -> a
concatCont :: forall a. [a -> a] -> a -> a
concatCont [a -> a]
xs a
rest = ((a -> a) -> a -> a) -> a -> [a -> a] -> a
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (a -> a) -> a -> a
forall a b. (a -> b) -> a -> b
($) a
rest [a -> a]
xs