ghcide-2.7.0.0: The core of an IDE

Safe Haskell | None
Language | GHC2021

Development.IDE.GHC.Compat.Util

Contents

- Exception handling
- Bags
- Boolean Formula
- OverridingBool
- Maybes
- Pair
- EnumSet
- FastString exports
- Fingerprint
- Unique
- UniqDFM
- String Buffer

Description

GHC Utils and Datastructures re-exports.

Mainly handles module hierarchy re-organisation of GHC from version to= 9.0.

Some Functions, such as `toList` shadow other function-names. This way this module can be imported qualified more naturally.

Synopsis

- class MonadThrow m => MonadCatch (m :: Type -> Type)
- data GhcException
- handleGhcException :: ExceptionMonad m => (GhcException -> m a) -> m a -> m a
- catch :: (HasCallStack, MonadCatch m, Exception e) => m a -> (e -> m a) -> m a
- try :: (HasCallStack, MonadCatch m, Exception e) => m a -> m (Either e a)
- data Bag a
- bagToList :: Bag a -> [a]
- listToBag :: [a] -> Bag a
- unionBags :: Bag a -> Bag a -> Bag a
- isEmptyBag :: Bag a -> Bool
- type LBooleanFormula a = LocatedL (BooleanFormula a)
- data BooleanFormula a
  - = Var a
  - | And [LBooleanFormula a]
  - | Or [LBooleanFormula a]
  - | Parens (LBooleanFormula a)
- data OverridingBool
  - = Auto
  - | Never
  - | Always
- data MaybeErr err val
  - = Succeeded val
  - | Failed err
- orElse :: Maybe a -> a -> a
- data Pair a = Pair {
  - pFst :: a
  - pSnd :: a
  }
- data EnumSet a
- toList :: Enum a => EnumSet a -> [a]
- data FastString
- newtype LexicalFastString = LexicalFastString FastString
- uniq :: FastString -> Int
- unpackFS :: FastString -> String
- mkFastString :: String -> FastString
- fsLit :: String -> FastString
- pprHsString :: FastString -> SDoc
- data Fingerprint = Fingerprint !Word64 !Word64
- getFileHash :: FilePath -> IO Fingerprint
- fingerprintData :: Ptr Word8 -> Int -> IO Fingerprint
- fingerprintString :: String -> Fingerprint
- fingerprintFingerprints :: [Fingerprint] -> Fingerprint
- class Uniquable a
- nonDetCmpUnique :: Unique -> Unique -> Ordering
- getUnique :: Uniquable a => a -> Unique
- data Unique
- mkUnique :: Char -> Int -> Unique
- newTagUnique :: Unique -> Char -> Unique
- emptyUDFM :: UniqDFM key elt
- plusUDFM :: UniqDFM key elt -> UniqDFM key elt -> UniqDFM key elt
- plusUDFM_C :: (elt -> elt -> elt) -> UniqDFM key elt -> UniqDFM key elt -> UniqDFM key elt
- data StringBuffer = StringBuffer {
  - buf :: !(ForeignPtr Word8)
  - len :: !Int
  - cur :: !Int
  }
- hGetStringBuffer :: FilePath -> IO StringBuffer
- stringToStringBuffer :: String -> StringBuffer
- nextChar :: StringBuffer -> (Char, StringBuffer)
- atEnd :: StringBuffer -> Bool

# Exception handling

class MonadThrow m => MonadCatch (m :: Type -> Type) #

A class for monads which allow exceptions to be caught, in particular exceptions which were thrown by `throwM`.

Instances should obey the following law:

    catch (throwM e) f = f e

Note that the ability to catch an exception does not guarantee that we can deal with all possible exit points from a computation. Some monads, such as continuation-based stacks, allow for more than just a success/failure strategy, and therefore `catch` cannot be used by those monads to properly implement a function such as `finally`. For more information, see `MonadMask`.

Minimal complete definition

catch

#### Instances

Instances details

MonadCatch STM |
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => STM a -> (e -> STM a) -> STM a #
MonadCatch Ghc |
Instance details Defined in GHC.Driver.Monad Methods catch :: (HasCallStack, Exception e) => Ghc a -> (e -> Ghc a) -> Ghc a #
MonadCatch HookedUse |
Instance details Defined in GHC.Driver.Pipeline.Execute Methods catch :: (HasCallStack, Exception e) => HookedUse a -> (e -> HookedUse a) -> HookedUse a #
MonadCatch IO |
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => IO a -> (e -> IO a) -> IO a #
MonadCatch Action |
Instance details Defined in Development.IDE.Graph.Internal.Types Methods catch :: (HasCallStack, Exception e) => Action a -> (e -> Action a) -> Action a #
e ~ SomeException => MonadCatch (Either e) | Since: exceptions-0.8.3
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e0) => Either e a -> (e0 -> Either e a) -> Either e a #
Monad m => MonadCatch (CatchT m) |
Instance details Defined in Control.Monad.Catch.Pure Methods catch :: (HasCallStack, Exception e) => CatchT m a -> (e -> CatchT m a) -> CatchT m a #
MonadCatch (IOEnv env) |
Instance details Defined in GHC.Data.IOEnv Methods catch :: (HasCallStack, Exception e) => IOEnv env a -> (e -> IOEnv env a) -> IOEnv env a #
MonadCatch m => MonadCatch (GhcT m) |
Instance details Defined in GHC.Driver.Monad Methods catch :: (HasCallStack, Exception e) => GhcT m a -> (e -> GhcT m a) -> GhcT m a #
MonadCatch m => MonadCatch (ResourceT m) |
Instance details Defined in Control.Monad.Trans.Resource.Internal Methods catch :: (HasCallStack, Exception e) => ResourceT m a -> (e -> ResourceT m a) -> ResourceT m a #
MonadCatch m => MonadCatch (MaybeT m) | Catches exceptions from the base monad.
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => MaybeT m a -> (e -> MaybeT m a) -> MaybeT m a #
(Functor f, MonadCatch m) => MonadCatch (FreeT f m) |
Instance details Defined in Control.Monad.Trans.Free Methods catch :: (HasCallStack, Exception e) => FreeT f m a -> (e -> FreeT f m a) -> FreeT f m a #
MonadCatch m => MonadCatch (LspT config m) |
Instance details Defined in Language.LSP.Server.Core Methods catch :: (HasCallStack, Exception e) => LspT config m a -> (e -> LspT config m a) -> LspT config m a #
MonadCatch m => MonadCatch (ExceptT e m) | Catches exceptions from the base monad.
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e0) => ExceptT e m a -> (e0 -> ExceptT e m a) -> ExceptT e m a #
MonadCatch m => MonadCatch (IdentityT m) |
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => IdentityT m a -> (e -> IdentityT m a) -> IdentityT m a #
MonadCatch m => MonadCatch (ReaderT r m) |
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => ReaderT r m a -> (e -> ReaderT r m a) -> ReaderT r m a #
MonadCatch m => MonadCatch (StateT s m) |
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => StateT s m a -> (e -> StateT s m a) -> StateT s m a #
MonadCatch m => MonadCatch (StateT s m) |
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => StateT s m a -> (e -> StateT s m a) -> StateT s m a #
(MonadCatch m, Monoid w) => MonadCatch (WriterT w m) |
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a #
(MonadCatch m, Monoid w) => MonadCatch (WriterT w m) |
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a #
(MonadCatch m, Monoid w) => MonadCatch (RWST r w s m) |
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a #
(MonadCatch m, Monoid w) => MonadCatch (RWST r w s m) |
Instance details Defined in Control.Monad.Catch Methods catch :: (HasCallStack, Exception e) => RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a #

data GhcException #

GHC's own exception type error messages all take the form:

         <location>: <error>

If the location is on the command line, or in GHC itself, then <location>="ghc". All of the error types below correspond to a <location> of "ghc", except for ProgramError (where the string is assumed to contain a location already, so we don't print one).

#### Instances

Instances details

Exception GhcException |
Instance details Defined in GHC.Utils.Panic Methods toException :: GhcException -> SomeException # fromException :: SomeException -> Maybe GhcException # displayException :: GhcException -> String #
Show GhcException |
Instance details Defined in GHC.Utils.Panic Methods showsPrec :: Int -> GhcException -> ShowS # show :: GhcException -> String # showList :: [GhcException] -> ShowS #

handleGhcException :: ExceptionMonad m => (GhcException -> m a) -> m a -> m a #

catch :: (HasCallStack, MonadCatch m, Exception e) => m a -> (e -> m a) -> m a #

Same as upstream `catch`, but will not catch asynchronous exceptions

Since: safe-exceptions-0.1.0.0

try :: (HasCallStack, MonadCatch m, Exception e) => m a -> m (Either e a) #

Same as upstream `try`, but will not catch asynchronous exceptions

Since: safe-exceptions-0.1.0.0

# Bags

data Bag a #

#### Instances

Instances details

Foldable Bag |

Instance details

Defined in GHC.Data.Bag

Methods

fold :: Monoid m => Bag m -> m #

foldMap :: Monoid m => (a -> m) -> Bag a -> m #

foldMap' :: Monoid m => (a -> m) -> Bag a -> m #

foldr :: (a -> b -> b) -> b -> Bag a -> b #

foldr' :: (a -> b -> b) -> b -> Bag a -> b #

foldl :: (b -> a -> b) -> b -> Bag a -> b #

foldl' :: (b -> a -> b) -> b -> Bag a -> b #

foldr1 :: (a -> a -> a) -> Bag a -> a #

foldl1 :: (a -> a -> a) -> Bag a -> a #

toList :: Bag a -> [a] #

null :: Bag a -> Bool #

length :: Bag a -> Int #

elem :: Eq a => a -> Bag a -> Bool #

maximum :: Ord a => Bag a -> a #

minimum :: Ord a => Bag a -> a #

sum :: Num a => Bag a -> a #

product :: Num a => Bag a -> a #

Traversable Bag |
Instance details Defined in GHC.Data.Bag Methods traverse :: Applicative f => (a -> f b) -> Bag a -> f (Bag b) # sequenceA :: Applicative f => Bag (f a) -> f (Bag a) # mapM :: Monad m => (a -> m b) -> Bag a -> m (Bag b) # sequence :: Monad m => Bag (m a) -> m (Bag a) #
Functor Bag |
Instance details Defined in GHC.Data.Bag Methods fmap :: (a -> b) -> Bag a -> Bag b # (<$) :: a -> Bag b -> Bag a #
Data a => Data (Bag a) |

Instance details

Defined in GHC.Data.Bag

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Bag a -> c (Bag a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Bag a) #

toConstr :: Bag a -> Constr #

dataTypeOf :: Bag a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Bag a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Bag a)) #

gmapT :: (forall b. Data b => b -> b) -> Bag a -> Bag a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Bag a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Bag a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Bag a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Bag a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Bag a -> m (Bag a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Bag a -> m (Bag a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Bag a -> m (Bag a) #

Monoid (Bag a) |
Instance details Defined in GHC.Data.Bag Methods mempty :: Bag a # mappend :: Bag a -> Bag a -> Bag a # mconcat :: [Bag a] -> Bag a #
Semigroup (Bag a) |
Instance details Defined in GHC.Data.Bag Methods (<>) :: Bag a -> Bag a -> Bag a # sconcat :: NonEmpty (Bag a) -> Bag a # stimes :: Integral b => b -> Bag a -> Bag a #
IsList (Bag a) |

Instance details

Defined in GHC.Data.Bag

Associated Types

type Item (Bag a) |
Instance details Defined in GHC.Data.Bag type Item (Bag a) = a

Methods

fromList :: [Item (Bag a)] -> Bag a #

fromListN :: Int -> [Item (Bag a)] -> Bag a #

toList :: Bag a -> [Item (Bag a)] #

Show a => Show (Bag a) # |
Instance details Defined in Development.IDE.GHC.Orphans Methods showsPrec :: Int -> Bag a -> ShowS # show :: Bag a -> String # showList :: [Bag a] -> ShowS #
NFData a => NFData (Bag a) |
Instance details Defined in GHC.Data.Bag Methods rnf :: Bag a -> () #
ToHie a => ToHie (Bag a) |
Instance details Defined in GHC.Iface.Ext.Ast Methods toHie :: Bag a -> HieM [HieAST Type]
Outputable a => Outputable (Bag a) |
Instance details Defined in GHC.Data.Bag Methods ppr :: Bag a -> SDoc #
type Item (Bag a) |
Instance details Defined in GHC.Data.Bag type Item (Bag a) = a

bagToList :: Bag a -> [a] #

listToBag :: [a] -> Bag a #

unionBags :: Bag a -> Bag a -> Bag a #

isEmptyBag :: Bag a -> Bool #

# Boolean Formula

type LBooleanFormula a = LocatedL (BooleanFormula a) #

data BooleanFormula a #

Constructors

Var a |
And [LBooleanFormula a] |
Or [LBooleanFormula a] |
Parens (LBooleanFormula a) |

#### Instances

Instances details

Foldable BooleanFormula |

Instance details

Defined in GHC.Data.BooleanFormula

Methods

fold :: Monoid m => BooleanFormula m -> m #

foldMap :: Monoid m => (a -> m) -> BooleanFormula a -> m #

foldMap' :: Monoid m => (a -> m) -> BooleanFormula a -> m #

foldr :: (a -> b -> b) -> b -> BooleanFormula a -> b #

foldr' :: (a -> b -> b) -> b -> BooleanFormula a -> b #

foldl :: (b -> a -> b) -> b -> BooleanFormula a -> b #

foldl' :: (b -> a -> b) -> b -> BooleanFormula a -> b #

foldr1 :: (a -> a -> a) -> BooleanFormula a -> a #

foldl1 :: (a -> a -> a) -> BooleanFormula a -> a #

toList :: BooleanFormula a -> [a] #

null :: BooleanFormula a -> Bool #

length :: BooleanFormula a -> Int #

elem :: Eq a => a -> BooleanFormula a -> Bool #

maximum :: Ord a => BooleanFormula a -> a #

minimum :: Ord a => BooleanFormula a -> a #

sum :: Num a => BooleanFormula a -> a #

product :: Num a => BooleanFormula a -> a #

Traversable BooleanFormula |
Instance details Defined in GHC.Data.BooleanFormula Methods traverse :: Applicative f => (a -> f b) -> BooleanFormula a -> f (BooleanFormula b) # sequenceA :: Applicative f => BooleanFormula (f a) -> f (BooleanFormula a) # mapM :: Monad m => (a -> m b) -> BooleanFormula a -> m (BooleanFormula b) # sequence :: Monad m => BooleanFormula (m a) -> m (BooleanFormula a) #
Functor BooleanFormula |
Instance details Defined in GHC.Data.BooleanFormula Methods fmap :: (a -> b) -> BooleanFormula a -> BooleanFormula b # (<$) :: a -> BooleanFormula b -> BooleanFormula a #
Data a => Data (BooleanFormula a) |

Instance details

Defined in GHC.Data.BooleanFormula

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BooleanFormula a -> c (BooleanFormula a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (BooleanFormula a) #

toConstr :: BooleanFormula a -> Constr #

dataTypeOf :: BooleanFormula a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (BooleanFormula a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (BooleanFormula a)) #

gmapT :: (forall b. Data b => b -> b) -> BooleanFormula a -> BooleanFormula a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BooleanFormula a -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BooleanFormula a -> r #

gmapQ :: (forall d. Data d => d -> u) -> BooleanFormula a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> BooleanFormula a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> BooleanFormula a -> m (BooleanFormula a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BooleanFormula a -> m (BooleanFormula a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BooleanFormula a -> m (BooleanFormula a) #

ToHie (LBooleanFormula (LocatedN Name)) |
Instance details Defined in GHC.Iface.Ext.Ast Methods toHie :: LBooleanFormula (LocatedN Name) -> HieM [HieAST Type]
OutputableBndr a => Outputable (BooleanFormula a) |
Instance details Defined in GHC.Data.BooleanFormula Methods ppr :: BooleanFormula a -> SDoc #
Eq a => Eq (BooleanFormula a) |
Instance details Defined in GHC.Data.BooleanFormula Methods (==) :: BooleanFormula a -> BooleanFormula a -> Bool # (/=) :: BooleanFormula a -> BooleanFormula a -> Bool #

# OverridingBool

data OverridingBool #

Constructors

Auto |
Never |
Always |

#### Instances

Instances details

Bounded OverridingBool | Since: ghc-9.4.1
Instance details Defined in GHC.Data.Bool Methods minBound :: OverridingBool # maxBound :: OverridingBool #
Enum OverridingBool | Since: ghc-9.4.1

Instance details

Defined in GHC.Data.Bool

Methods

succ :: OverridingBool -> OverridingBool #

pred :: OverridingBool -> OverridingBool #

toEnum :: Int -> OverridingBool #

fromEnum :: OverridingBool -> Int #

enumFrom :: OverridingBool -> [OverridingBool] #

enumFromThen :: OverridingBool -> OverridingBool -> [OverridingBool] #

enumFromTo :: OverridingBool -> OverridingBool -> [OverridingBool] #

enumFromThenTo :: OverridingBool -> OverridingBool -> OverridingBool -> [OverridingBool] #

Read OverridingBool | Since: ghc-9.4.1
Instance details Defined in GHC.Data.Bool Methods readsPrec :: Int -> ReadS OverridingBool # readList :: ReadS [OverridingBool] # readPrec :: ReadPrec OverridingBool # readListPrec :: ReadPrec [OverridingBool] #
Show OverridingBool |
Instance details Defined in GHC.Data.Bool Methods showsPrec :: Int -> OverridingBool -> ShowS # show :: OverridingBool -> String # showList :: [OverridingBool] -> ShowS #
Eq OverridingBool | Since: ghc-9.4.1
Instance details Defined in GHC.Data.Bool Methods (==) :: OverridingBool -> OverridingBool -> Bool # (/=) :: OverridingBool -> OverridingBool -> Bool #
Ord OverridingBool | Since: ghc-9.4.1

Instance details

Defined in GHC.Data.Bool

Methods

compare :: OverridingBool -> OverridingBool -> Ordering #

(<) :: OverridingBool -> OverridingBool -> Bool #

(<=) :: OverridingBool -> OverridingBool -> Bool #

(>) :: OverridingBool -> OverridingBool -> Bool #

(>=) :: OverridingBool -> OverridingBool -> Bool #

max :: OverridingBool -> OverridingBool -> OverridingBool #

min :: OverridingBool -> OverridingBool -> OverridingBool #

# Maybes

data MaybeErr err val #

Constructors

Succeeded val |
Failed err |

#### Instances

Instances details

Applicative (MaybeErr err) |
Instance details Defined in GHC.Data.Maybe Methods pure :: a -> MaybeErr err a # (<*>) :: MaybeErr err (a -> b) -> MaybeErr err a -> MaybeErr err b # liftA2 :: (a -> b -> c) -> MaybeErr err a -> MaybeErr err b -> MaybeErr err c # (*>) :: MaybeErr err a -> MaybeErr err b -> MaybeErr err b # (<*) :: MaybeErr err a -> MaybeErr err b -> MaybeErr err a #
Functor (MaybeErr err) |
Instance details Defined in GHC.Data.Maybe Methods fmap :: (a -> b) -> MaybeErr err a -> MaybeErr err b # (<$) :: a -> MaybeErr err b -> MaybeErr err a #
Monad (MaybeErr err) |
Instance details Defined in GHC.Data.Maybe Methods (>>=) :: MaybeErr err a -> (a -> MaybeErr err b) -> MaybeErr err b # (>>) :: MaybeErr err a -> MaybeErr err b -> MaybeErr err b # return :: a -> MaybeErr err a #

orElse :: Maybe a -> a -> a infixr 4 #

Flipped version of `fromMaybe`, useful for chaining.

# Pair

data Pair a #

Constructors

Pair |

Fields

- pFst :: a
- pSnd :: a

#### Instances

Instances details

Foldable Pair |

Instance details

Defined in GHC.Data.Pair

Methods

fold :: Monoid m => Pair m -> m #

foldMap :: Monoid m => (a -> m) -> Pair a -> m #

foldMap' :: Monoid m => (a -> m) -> Pair a -> m #

foldr :: (a -> b -> b) -> b -> Pair a -> b #

foldr' :: (a -> b -> b) -> b -> Pair a -> b #

foldl :: (b -> a -> b) -> b -> Pair a -> b #

foldl' :: (b -> a -> b) -> b -> Pair a -> b #

foldr1 :: (a -> a -> a) -> Pair a -> a #

foldl1 :: (a -> a -> a) -> Pair a -> a #

toList :: Pair a -> [a] #

null :: Pair a -> Bool #

length :: Pair a -> Int #

elem :: Eq a => a -> Pair a -> Bool #

maximum :: Ord a => Pair a -> a #

minimum :: Ord a => Pair a -> a #

sum :: Num a => Pair a -> a #

product :: Num a => Pair a -> a #

Traversable Pair |
Instance details Defined in GHC.Data.Pair Methods traverse :: Applicative f => (a -> f b) -> Pair a -> f (Pair b) # sequenceA :: Applicative f => Pair (f a) -> f (Pair a) # mapM :: Monad m => (a -> m b) -> Pair a -> m (Pair b) # sequence :: Monad m => Pair (m a) -> m (Pair a) #
Applicative Pair |
Instance details Defined in GHC.Data.Pair Methods pure :: a -> Pair a # (<*>) :: Pair (a -> b) -> Pair a -> Pair b # liftA2 :: (a -> b -> c) -> Pair a -> Pair b -> Pair c # (*>) :: Pair a -> Pair b -> Pair b # (<*) :: Pair a -> Pair b -> Pair a #
Functor Pair |
Instance details Defined in GHC.Data.Pair Methods fmap :: (a -> b) -> Pair a -> Pair b # (<$) :: a -> Pair b -> Pair a #
(Semigroup a, Monoid a) => Monoid (Pair a) |
Instance details Defined in GHC.Data.Pair Methods mempty :: Pair a # mappend :: Pair a -> Pair a -> Pair a # mconcat :: [Pair a] -> Pair a #
Semigroup a => Semigroup (Pair a) |
Instance details Defined in GHC.Data.Pair Methods (<>) :: Pair a -> Pair a -> Pair a # sconcat :: NonEmpty (Pair a) -> Pair a # stimes :: Integral b => b -> Pair a -> Pair a #
Outputable a => Outputable (Pair a) |
Instance details Defined in GHC.Data.Pair Methods ppr :: Pair a -> SDoc #

# EnumSet

data EnumSet a #

#### Instances

Instances details

Monoid (EnumSet a) |
Instance details Defined in GHC.Data.EnumSet Methods mempty :: EnumSet a # mappend :: EnumSet a -> EnumSet a -> EnumSet a # mconcat :: [EnumSet a] -> EnumSet a #
Semigroup (EnumSet a) |
Instance details Defined in GHC.Data.EnumSet Methods (<>) :: EnumSet a -> EnumSet a -> EnumSet a # sconcat :: NonEmpty (EnumSet a) -> EnumSet a # stimes :: Integral b => b -> EnumSet a -> EnumSet a #
NFData (EnumSet a) |
Instance details Defined in GHC.Data.EnumSet Methods rnf :: EnumSet a -> () #
Binary (EnumSet a) | Represents the `EnumSet` as a bit set. Assumes that all elements are non-negative. This is only efficient for values that are sufficiently small, for example in the lower hundreds.
Instance details Defined in GHC.Data.EnumSet Methods put_ :: BinHandle -> EnumSet a -> IO () # put :: BinHandle -> EnumSet a -> IO (Bin (EnumSet a)) # get :: BinHandle -> IO (EnumSet a) #

toList :: Enum a => EnumSet a -> [a] #

# FastString exports

data FastString #

A `FastString` is a UTF-8 encoded string together with a unique ID. All `FastString`s are stored in a global hashtable to support fast O(1) comparison.

It is also associated with a lazy reference to the Z-encoding of this string which is used by the compiler internally.

#### Instances

Instances details

Data FastString |

Instance details

Defined in GHC.Data.FastString

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FastString -> c FastString #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FastString #

toConstr :: FastString -> Constr #

dataTypeOf :: FastString -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FastString) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FastString) #

gmapT :: (forall b. Data b => b -> b) -> FastString -> FastString #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FastString -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FastString -> r #

gmapQ :: (forall d. Data d => d -> u) -> FastString -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> FastString -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> FastString -> m FastString #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FastString -> m FastString #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FastString -> m FastString #

IsString FastString |
Instance details Defined in GHC.Data.FastString Methods fromString :: String -> FastString #
Monoid FastString |
Instance details Defined in GHC.Data.FastString Methods mempty :: FastString # mappend :: FastString -> FastString -> FastString # mconcat :: [FastString] -> FastString #
Semigroup FastString |
Instance details Defined in GHC.Data.FastString Methods (<>) :: FastString -> FastString -> FastString # sconcat :: NonEmpty FastString -> FastString # stimes :: Integral b => b -> FastString -> FastString #
Show FastString |
Instance details Defined in GHC.Data.FastString Methods showsPrec :: Int -> FastString -> ShowS # show :: FastString -> String # showList :: [FastString] -> ShowS #
NFData FastString |
Instance details Defined in GHC.Data.FastString Methods rnf :: FastString -> () #
ToJExpr FastString |
Instance details Defined in GHC.JS.Make Methods toJExpr :: FastString -> JExpr # toJExprFromList :: [FastString] -> JExpr #
Uniquable FastString |
Instance details Defined in GHC.Types.Unique Methods getUnique :: FastString -> Unique #
Binary FastString |
Instance details Defined in GHC.Utils.Binary Methods put_ :: BinHandle -> FastString -> IO () # put :: BinHandle -> FastString -> IO (Bin FastString) # get :: BinHandle -> IO FastString #
Outputable FastString |
Instance details Defined in GHC.Utils.Outputable Methods ppr :: FastString -> SDoc #
Eq FastString |
Instance details Defined in GHC.Data.FastString Methods (==) :: FastString -> FastString -> Bool # (/=) :: FastString -> FastString -> Bool #
Ord FastString # |
Instance details Defined in Development.IDE.GHC.Orphans Methods compare :: FastString -> FastString -> Ordering # (<) :: FastString -> FastString -> Bool # (<=) :: FastString -> FastString -> Bool # (>) :: FastString -> FastString -> Bool # (>=) :: FastString -> FastString -> Bool # max :: FastString -> FastString -> FastString # min :: FastString -> FastString -> FastString #
ToJExpr a => ToJExpr (UniqMap FastString a) |
Instance details Defined in GHC.JS.Make Methods toJExpr :: UniqMap FastString a -> JExpr # toJExprFromList :: [UniqMap FastString a] -> JExpr #
type Anno FastString |
Instance details Defined in GHC.Hs.Expr type Anno FastString = SrcAnn NoEpAnns
type Anno (SourceText, RuleName) |
Instance details Defined in GHC.Hs.Decls type Anno (SourceText, RuleName) = SrcAnn NoEpAnns

newtype LexicalFastString #

Lexical FastString

This is a simple FastString wrapper with an Ord instance using `lexicalCompareFS` (i.e. which compares FastStrings on their String representation). Hence it is deterministic from one run to the other.

Constructors

LexicalFastString FastString |

#### Instances

Instances details

Data LexicalFastString |

Instance details

Defined in GHC.Data.FastString

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LexicalFastString -> c LexicalFastString #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LexicalFastString #

toConstr :: LexicalFastString -> Constr #

dataTypeOf :: LexicalFastString -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LexicalFastString) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LexicalFastString) #

gmapT :: (forall b. Data b => b -> b) -> LexicalFastString -> LexicalFastString #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LexicalFastString -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LexicalFastString -> r #

gmapQ :: (forall d. Data d => d -> u) -> LexicalFastString -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> LexicalFastString -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> LexicalFastString -> m LexicalFastString #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LexicalFastString -> m LexicalFastString #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LexicalFastString -> m LexicalFastString #

Show LexicalFastString |
Instance details Defined in GHC.Data.FastString Methods showsPrec :: Int -> LexicalFastString -> ShowS # show :: LexicalFastString -> String # showList :: [LexicalFastString] -> ShowS #
Binary LexicalFastString |
Instance details Defined in GHC.Utils.Binary Methods put_ :: BinHandle -> LexicalFastString -> IO () # put :: BinHandle -> LexicalFastString -> IO (Bin LexicalFastString) # get :: BinHandle -> IO LexicalFastString #
Outputable LexicalFastString |
Instance details Defined in GHC.Utils.Outputable Methods ppr :: LexicalFastString -> SDoc #
Eq LexicalFastString |
Instance details Defined in GHC.Data.FastString Methods (==) :: LexicalFastString -> LexicalFastString -> Bool # (/=) :: LexicalFastString -> LexicalFastString -> Bool #
Ord LexicalFastString |

Instance details

Defined in GHC.Data.FastString

Methods

compare :: LexicalFastString -> LexicalFastString -> Ordering #

(<) :: LexicalFastString -> LexicalFastString -> Bool #

(<=) :: LexicalFastString -> LexicalFastString -> Bool #

(>) :: LexicalFastString -> LexicalFastString -> Bool #

(>=) :: LexicalFastString -> LexicalFastString -> Bool #

max :: LexicalFastString -> LexicalFastString -> LexicalFastString #

min :: LexicalFastString -> LexicalFastString -> LexicalFastString #

uniq :: FastString -> Int #

unpackFS :: FastString -> String #

Lazily unpacks and decodes the FastString

mkFastString :: String -> FastString #

Creates a UTF-8 encoded `FastString` from a `String`

fsLit :: String -> FastString #

pprHsString :: FastString -> SDoc #

Special combinator for showing string literals.

# Fingerprint

data Fingerprint #

Constructors

Fingerprint !Word64 !Word64 |

#### Instances

Instances details

Storable Fingerprint | Since: base-4.4.0.0

Instance details

Defined in Foreign.Storable

Methods

sizeOf :: Fingerprint -> Int #

alignment :: Fingerprint -> Int #

peekElemOff :: Ptr Fingerprint -> Int -> IO Fingerprint #

pokeElemOff :: Ptr Fingerprint -> Int -> Fingerprint -> IO () #

peekByteOff :: Ptr b -> Int -> IO Fingerprint #

pokeByteOff :: Ptr b -> Int -> Fingerprint -> IO () #

peek :: Ptr Fingerprint -> IO Fingerprint #

poke :: Ptr Fingerprint -> Fingerprint -> IO () #

Generic Fingerprint |

Instance details

Defined in GHC.Generics

Associated Types

type Rep Fingerprint | Since: base-4.15.0.0
Instance details Defined in GHC.Generics type Rep Fingerprint = D1 ('MetaData "Fingerprint" "GHC.Fingerprint.Type" "base" 'False) (C1 ('MetaCons "Fingerprint" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Word64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Word64)))

Methods

from :: Fingerprint -> Rep Fingerprint x #

to :: Rep Fingerprint x -> Fingerprint #

Show Fingerprint | Since: base-4.7.0.0
Instance details Defined in GHC.Fingerprint.Type Methods showsPrec :: Int -> Fingerprint -> ShowS # show :: Fingerprint -> String # showList :: [Fingerprint] -> ShowS #
Binary Fingerprint | Since: binary-0.7.6.0
Instance details Defined in Data.Binary.Class Methods put :: Fingerprint -> Put # get :: Get Fingerprint # putList :: [Fingerprint] -> Put #
NFData Fingerprint | Since: deepseq-1.4.0.0
Instance details Defined in Control.DeepSeq Methods rnf :: Fingerprint -> () #
Binary Fingerprint |
Instance details Defined in GHC.Utils.Binary Methods put_ :: BinHandle -> Fingerprint -> IO () # put :: BinHandle -> Fingerprint -> IO (Bin Fingerprint) # get :: BinHandle -> IO Fingerprint #
Outputable Fingerprint |
Instance details Defined in GHC.Utils.Outputable Methods ppr :: Fingerprint -> SDoc #
Eq Fingerprint | Since: base-4.4.0.0
Instance details Defined in GHC.Fingerprint.Type Methods (==) :: Fingerprint -> Fingerprint -> Bool # (/=) :: Fingerprint -> Fingerprint -> Bool #
Ord Fingerprint | Since: base-4.4.0.0
Instance details Defined in GHC.Fingerprint.Type Methods compare :: Fingerprint -> Fingerprint -> Ordering # (<) :: Fingerprint -> Fingerprint -> Bool # (<=) :: Fingerprint -> Fingerprint -> Bool # (>) :: Fingerprint -> Fingerprint -> Bool # (>=) :: Fingerprint -> Fingerprint -> Bool # max :: Fingerprint -> Fingerprint -> Fingerprint # min :: Fingerprint -> Fingerprint -> Fingerprint #
Hashable Fingerprint | Since: hashable-1.3.0.0
Instance details Defined in Data.Hashable.Class Methods hashWithSalt :: Int -> Fingerprint -> Int # hash :: Fingerprint -> Int #
type Rep Fingerprint | Since: base-4.15.0.0
Instance details Defined in GHC.Generics type Rep Fingerprint = D1 ('MetaData "Fingerprint" "GHC.Fingerprint.Type" "base" 'False) (C1 ('MetaCons "Fingerprint" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Word64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedUnpack) (Rec0 Word64)))

getFileHash :: FilePath -> IO Fingerprint #

Computes the hash of a given file. This function loops over the handle, running in constant memory.

Since: base-4.7.0.0

fingerprintData :: Ptr Word8 -> Int -> IO Fingerprint #

fingerprintString :: String -> Fingerprint #

fingerprintFingerprints :: [Fingerprint] -> Fingerprint #

# Unique

class Uniquable a #

Class of things that we can obtain a `Unique` from

Minimal complete definition

getUnique

#### Instances

Instances details

Uniquable Label |
Instance details Defined in GHC.Cmm.Dataflow.Label Methods getUnique :: Label -> Unique #
Uniquable LocalReg |
Instance details Defined in GHC.Cmm.Reg Methods getUnique :: LocalReg -> Unique #
Uniquable Reg | so we can put regs in UniqSets
Instance details Defined in GHC.CmmToAsm.Reg.Graph.Base Methods getUnique :: Reg -> Unique #
Uniquable Store |
Instance details Defined in GHC.CmmToAsm.Reg.Graph.SpillClean Methods getUnique :: Store -> Unique #
Uniquable SymName |
Instance details Defined in GHC.CmmToAsm.Wasm.Types Methods getUnique :: SymName -> Unique #
Uniquable Class |
Instance details Defined in GHC.Core.Class Methods getUnique :: Class -> Unique #
Uniquable CoAxiomRule |
Instance details Defined in GHC.Core.Coercion.Axiom Methods getUnique :: CoAxiomRule -> Unique #
Uniquable ConLike |
Instance details Defined in GHC.Core.ConLike Methods getUnique :: ConLike -> Unique #
Uniquable DataCon |
Instance details Defined in GHC.Core.DataCon Methods getUnique :: DataCon -> Unique #
Uniquable PatSyn |
Instance details Defined in GHC.Core.PatSyn Methods getUnique :: PatSyn -> Unique #
Uniquable CoercionHole |
Instance details Defined in GHC.Core.TyCo.Rep Methods getUnique :: CoercionHole -> Unique #
Uniquable TyCon |
Instance details Defined in GHC.Core.TyCon Methods getUnique :: TyCon -> Unique #
Uniquable FastString |
Instance details Defined in GHC.Types.Unique Methods getUnique :: FastString -> Unique #
Uniquable Ident |
Instance details Defined in GHC.JS.Unsat.Syntax Methods getUnique :: Ident -> Unique #
Uniquable RealReg |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: RealReg -> Unique #
Uniquable Reg |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: Reg -> Unique #
Uniquable VirtualReg |
Instance details Defined in GHC.Platform.Reg Methods getUnique :: VirtualReg -> Unique #
Uniquable RegClass |
Instance details Defined in GHC.Platform.Reg.Class Methods getUnique :: RegClass -> Unique #
Uniquable EvBindsVar |
Instance details Defined in GHC.Tc.Types.Evidence Methods getUnique :: EvBindsVar -> Unique #
Uniquable SkolemInfo |
Instance details Defined in GHC.Tc.Types.Origin Methods getUnique :: SkolemInfo -> Unique #
Uniquable ConLikeName |
Instance details Defined in GHC.Types.GREInfo Methods getUnique :: ConLikeName -> Unique #
Uniquable Name |
Instance details Defined in GHC.Types.Name Methods getUnique :: Name -> Unique #
Uniquable NameSpace |
Instance details Defined in GHC.Types.Name.Occurrence Methods getUnique :: NameSpace -> Unique #
Uniquable Unique |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Unique -> Unique #
Uniquable Var |
Instance details Defined in GHC.Types.Var Methods getUnique :: Var -> Unique #
Uniquable PackageId |
Instance details Defined in GHC.Unit.Info Methods getUnique :: PackageId -> Unique #
Uniquable PackageName |
Instance details Defined in GHC.Unit.Info Methods getUnique :: PackageName -> Unique #
Uniquable WarningCategory |
Instance details Defined in GHC.Unit.Module.Warnings Methods getUnique :: WarningCategory -> Unique #
Uniquable Module |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Module -> Unique #
Uniquable UnitId |
Instance details Defined in GHC.Unit.Types Methods getUnique :: UnitId -> Unique #
Uniquable ModuleName |
Instance details Defined in GHC.Types.Unique Methods getUnique :: ModuleName -> Unique #
Uniquable Int |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Int -> Unique #
Uniquable (CoAxiom br) |
Instance details Defined in GHC.Core.Coercion.Axiom Methods getUnique :: CoAxiom br -> Unique #
Uniquable unit => Uniquable (Definite unit) |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Definite unit -> Unique #
IsUnitId u => Uniquable (GenUnit u) |
Instance details Defined in GHC.Unit.Types Methods getUnique :: GenUnit u -> Unique #

nonDetCmpUnique :: Unique -> Unique -> Ordering #

getUnique :: Uniquable a => a -> Unique #

data Unique #

Unique identifier.

The type of unique identifiers that are used in many places in GHC for fast ordering and equality tests. You should generate these with the functions from the `UniqSupply` module

These are sometimes also referred to as "keys" in comments in GHC.

#### Instances

Instances details

Show Unique |
Instance details Defined in GHC.Types.Unique Methods showsPrec :: Int -> Unique -> ShowS # show :: Unique -> String # showList :: [Unique] -> ShowS #
Uniquable Unique |
Instance details Defined in GHC.Types.Unique Methods getUnique :: Unique -> Unique #
Outputable Unique |
Instance details Defined in GHC.Types.Unique Methods ppr :: Unique -> SDoc #
Eq Unique |
Instance details Defined in GHC.Types.Unique Methods (==) :: Unique -> Unique -> Bool # (/=) :: Unique -> Unique -> Bool #

mkUnique :: Char -> Int -> Unique #

newTagUnique :: Unique -> Char -> Unique #

# UniqDFM

emptyUDFM :: UniqDFM key elt #

plusUDFM :: UniqDFM key elt -> UniqDFM key elt -> UniqDFM key elt #

plusUDFM_C :: (elt -> elt -> elt) -> UniqDFM key elt -> UniqDFM key elt -> UniqDFM key elt #

# String Buffer

data StringBuffer #

A StringBuffer is an internal pointer to a sized chunk of bytes. The bytes are intended to be *immutable*. There are pure operations to read the contents of a StringBuffer.

A StringBuffer may have a finalizer, depending on how it was obtained.

Constructors

StringBuffer |

Fields

- buf :: !(ForeignPtr Word8)
- len :: !Int
- cur :: !Int

#### Instances

Instances details

Show StringBuffer |
Instance details Defined in GHC.Data.StringBuffer Methods showsPrec :: Int -> StringBuffer -> ShowS # show :: StringBuffer -> String # showList :: [StringBuffer] -> ShowS #
NFData StringBuffer # |
Instance details Defined in Development.IDE.GHC.Orphans Methods rnf :: StringBuffer -> () #

hGetStringBuffer :: FilePath -> IO StringBuffer #

Read a file into a `StringBuffer`. The resulting buffer is automatically managed by the garbage collector.

stringToStringBuffer :: String -> StringBuffer #

Encode a `String` into a `StringBuffer` as UTF-8. The resulting buffer is automatically managed by the garbage collector.

nextChar :: StringBuffer -> (Char, StringBuffer) #

Return the first UTF-8 character of a nonempty `StringBuffer` and as well the remaining portion (analogous to `uncons`). Warning: The behavior is undefined if the `StringBuffer` is empty. The result shares the same buffer as the original. Similar to `utf8DecodeChar`, if the character cannot be decoded as UTF-8, `'\0'` is returned.

atEnd :: StringBuffer -> Bool #

Check whether a `StringBuffer` is empty (analogous to `null`).