Safe Haskell | None |
---|---|
Language | Haskell2010 |
Development.IDE.GHC.Compat.Util
Description
Synopsis
- type MonadCatch = ExceptionMonad
- data GhcException
- handleGhcException :: ExceptionMonad m => (GhcException -> m a) -> m a -> m a
- catch :: (ExceptionMonad m, Exception e) => m a -> (e -> m a) -> m a
- try :: (ExceptionMonad 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 = Located (BooleanFormula a)
- data BooleanFormula a
- = Var a
- | And [LBooleanFormula a]
- | Or [LBooleanFormula a]
- | Parens (LBooleanFormula a)
- data OverridingBool
- data MaybeErr err val
- orElse :: Maybe a -> a -> a
- data Pair a = Pair {}
- data EnumSet a
- toList :: Enum a => EnumSet a -> [a]
- data 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 elt
- plusUDFM :: UniqDFM elt -> UniqDFM elt -> UniqDFM elt
- plusUDFM_C :: (elt -> elt -> elt) -> UniqDFM elt -> UniqDFM elt -> UniqDFM elt
- data StringBuffer = StringBuffer {}
- hGetStringBuffer :: FilePath -> IO StringBuffer
- stringToStringBuffer :: String -> StringBuffer
- nextChar :: StringBuffer -> (Char, StringBuffer)
- atEnd :: StringBuffer -> Bool
- is_ident :: Char -> Bool
Exception handling
type MonadCatch = ExceptionMonad Source #
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
Show GhcException | |
Defined in Panic Methods showsPrec :: Int -> GhcException -> ShowS # show :: GhcException -> String # showList :: [GhcException] -> ShowS # | |
Exception GhcException | |
Defined in Panic Methods toException :: GhcException -> SomeException # fromException :: SomeException -> Maybe GhcException # displayException :: GhcException -> String # |
handleGhcException :: ExceptionMonad m => (GhcException -> m a) -> m a -> m a #
catch :: (ExceptionMonad m, Exception e) => m a -> (e -> m a) -> m a Source #
Bags
Instances
Functor Bag | |
Foldable Bag | |
Defined in 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 # elem :: Eq a => a -> Bag a -> Bool # maximum :: Ord a => Bag a -> a # | |
Traversable Bag | |
Data a => Data (Bag a) | |
Defined in 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) # 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) # | |
Show a => Show (Bag a) Source # | |
Outputable a => Outputable (Bag a) | |
ToHie a => ToHie (Bag a) | |
Defined in Compat.HieAst |
isEmptyBag :: Bag a -> Bool #
Boolean Formula
type LBooleanFormula a = Located (BooleanFormula a) #
data BooleanFormula a #
Constructors
Var a | |
And [LBooleanFormula a] | |
Or [LBooleanFormula a] | |
Parens (LBooleanFormula a) |
Instances
OverridingBool
data OverridingBool #
Instances
Show OverridingBool | |
Defined in Util Methods showsPrec :: Int -> OverridingBool -> ShowS # show :: OverridingBool -> String # showList :: [OverridingBool] -> ShowS # |
Maybes
Instances
Monad (MaybeErr err) | |
Functor (MaybeErr err) | |
Applicative (MaybeErr err) | |
Pair
Instances
Functor Pair | |
Applicative Pair | |
Foldable Pair | |
Defined in 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 # elem :: Eq a => a -> Pair a -> Bool # maximum :: Ord a => Pair a -> a # | |
Traversable Pair | |
Semigroup a => Semigroup (Pair a) | |
(Semigroup a, Monoid a) => Monoid (Pair a) | |
Outputable a => Outputable (Pair a) | |
EnumSet
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
uniq :: FastString -> Int #
unpackFS :: FastString -> String #
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
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 #
Unique
Class of things that we can obtain a Unique
from
Minimal complete definition
Instances
nonDetCmpUnique :: Unique -> Unique -> Ordering #
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.
newTagUnique :: Unique -> Char -> Unique #
UniqDFM
plusUDFM_C :: (elt -> elt -> elt) -> UniqDFM elt -> UniqDFM elt -> UniqDFM 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 | |
Instances
Show StringBuffer | |
Defined in StringBuffer Methods showsPrec :: Int -> StringBuffer -> ShowS # show :: StringBuffer -> String # showList :: [StringBuffer] -> ShowS # | |
NFData StringBuffer Source # | |
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
).