| Copyright | (C) 2012-2016 University of Twente |
|---|---|
| License | BSD2 (see the file LICENSE) |
| Maintainer | QBayLogic B.V. <devops@qbaylogic.com> |
| Safe Haskell | None |
| Language | Haskell2010 |
Clash.Util
Description
Assortment of utility function used in the Clash library
Synopsis
- curLoc :: Q Exp
- clogBase :: Integer -> Integer -> Maybe Int
- makeCached :: (MonadState s m, Hashable k, Eq k) => k -> Lens' s (HashMap k v) -> m v -> m v
- indexNote :: HasCallStack => String -> [a] -> Int -> a
- pprPanic :: String -> Doc ann -> a
- thenCompare :: Ordering -> Ordering -> Ordering
- data ClashException = ClashException SrcSpan String (Maybe String)
- reportTimeDiff :: UTCTime -> UTCTime -> String
- wantedLanguageExtensions :: [Extension]
- unwantedLanguageExtensions :: [Extension]
- class Monad m => MonadUnique (m :: Type -> Type) where
- getUniqueM :: m Unique
- makeCachedU :: (MonadState s m, Uniquable k) => k -> Lens' s (UniqMap v) -> m v -> m v
- pprDebugAndThen :: (String -> a) -> Doc ann -> Doc ann -> a
- namePat :: Name -> Q Pat
- assertPanic :: String -> Int -> a
- assertPprPanic :: HasCallStack => String -> Int -> Doc ann -> a
- callStackDoc :: HasCallStack => Doc ann
- warnPprTrace :: HasCallStack => Bool -> String -> Int -> Doc ann -> a -> a
- pprTrace :: String -> Doc ann -> a -> a
- pprTraceDebug :: String -> Doc ann -> a -> a
- makeCachedO :: (MonadState s m, Uniquable k) => k -> Lens' s (OMap Unique v) -> m v -> m v
- indexNote' :: HasCallStack => String -> Int -> [a] -> a
- clashLibVersion :: Version
- flogBase :: Integer -> Integer -> Maybe Int
- pkgIdFromTypeable :: Typeable a => a -> String
- orElses :: [Maybe a] -> Maybe a
- data SrcSpan
- noSrcSpan :: SrcSpan
- hoistMaybe :: forall (m :: Type -> Type) b. Applicative m => Maybe b -> MaybeT m b
Documentation
Create a TH expression that returns the a formatted string containing the
name of the module curLoc is spliced into, and the line where it was spliced.
Arguments
| :: (MonadState s m, Hashable k, Eq k) | |
| => k | The key the action is associated with |
| -> Lens' s (HashMap k v) | The Lens to the HashMap that is the cache |
| -> m v | The action to cache |
| -> m v |
Cache the result of a monadic action
Arguments
| :: HasCallStack | |
| => String | Error message to display |
| -> [a] | List to index |
| -> Int | Index n |
| -> a | Error or element n |
Unsafe indexing, return a custom error message when indexing fails
data ClashException Source #
Constructors
| ClashException SrcSpan String (Maybe String) |
Instances
| Exception ClashException Source # | |
Defined in Clash.Util Methods toException :: ClashException -> SomeException fromException :: SomeException -> Maybe ClashException | |
| Show ClashException Source # | |
Defined in Clash.Util Methods showsPrec :: Int -> ClashException -> ShowS # show :: ClashException -> String # showList :: [ClashException] -> ShowS # | |
reportTimeDiff :: UTCTime -> UTCTime -> String Source #
wantedLanguageExtensions :: [Extension] Source #
unwantedLanguageExtensions :: [Extension] Source #
class Monad m => MonadUnique (m :: Type -> Type) where Source #
A class that can generate unique numbers
Instances
| MonadUnique (RewriteMonad extra) Source # | |
Defined in Clash.Rewrite.Types Methods getUniqueM :: RewriteMonad extra Unique Source # | |
| Monad m => MonadUnique (StateT Unique m) Source # | |
Defined in Clash.Util Methods getUniqueM :: StateT Unique m Unique Source # | |
Arguments
| :: (MonadState s m, Uniquable k) | |
| => k | Key the action is associated with |
| -> Lens' s (UniqMap v) | Lens to the cache |
| -> m v | Action to cache |
| -> m v |
Cache the result of a monadic action using a UniqMap
namePat :: Name -> Q Pat Source #
Construct a string pattern match out of the given TemplateHaskell name
assertPanic :: String -> Int -> a Source #
callStackDoc :: HasCallStack => Doc ann Source #
pprTraceDebug :: String -> Doc ann -> a -> a Source #
Arguments
| :: (MonadState s m, Uniquable k) | |
| => k | Key the action is associated with |
| -> Lens' s (OMap Unique v) | Lens to the cache |
| -> m v | Action to cache |
| -> m v |
Cache the result of a monadic action using a OMap
Arguments
| :: HasCallStack | |
| => String | Error message to display |
| -> Int | Index n |
| -> [a] | List to index |
| -> a | Error or element n |
Same as indexNote with last two arguments swapped
clashLibVersion :: Version Source #
pkgIdFromTypeable :: Typeable a => a -> String Source #
Get the package id of the type of a value
>>>pkgIdFromTypeable (0 :: Unsigned 32)"clash-prelude-...
Instances
| Binary SrcSpan | |||||
| PrettyPrec SrcSpan Source # | |||||
| NFData SrcSpan | |||||
Defined in GHC.Types.SrcLoc | |||||
| HasAnnotation SrcSpan | |||||
Defined in GHC.Parser.Annotation Methods noAnnSrcSpan :: SrcSpan -> SrcSpan | |||||
| HasLoc SrcSpan | |||||
Defined in GHC.Parser.Annotation | |||||
| ToJson SrcSpan | |||||
Defined in GHC.Types.SrcLoc | |||||
| Outputable SrcSpan | |||||
Defined in GHC.Types.SrcLoc | |||||
| Data SrcSpan | |||||
Defined in GHC.Types.SrcLoc Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcSpan -> c SrcSpan gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcSpan dataTypeOf :: SrcSpan -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SrcSpan) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcSpan) gmapT :: (forall b. Data b => b -> b) -> SrcSpan -> SrcSpan gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpan -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpan -> r gmapQ :: (forall d. Data d => d -> u) -> SrcSpan -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcSpan -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan | |||||
| Generic SrcSpan Source # | |||||
Defined in GHC.SrcLoc.Extra Associated Types
| |||||
| Show SrcSpan | |||||
| Eq SrcSpan | |||||
| Hashable SrcSpan Source # | |||||
| ToHie (LHsDoc GhcRn) | |||||
Defined in GHC.Iface.Ext.Ast Methods toHie :: LHsDoc GhcRn -> HieM [HieAST Type] | |||||
| ToHie (Context (Located Name)) | |||||
Defined in GHC.Iface.Ext.Ast Methods toHie :: Context (Located Name) -> HieM [HieAST Type] | |||||
| ToHie (Context (Located Var)) | |||||
Defined in GHC.Iface.Ext.Ast Methods toHie :: Context (Located Var) -> HieM [HieAST Type] | |||||
| ToHie (Context (Located NoExtField)) | |||||
Defined in GHC.Iface.Ext.Ast Methods toHie :: Context (Located NoExtField) -> HieM [HieAST Type] | |||||
| ToHie (IEContext (Located RecFieldInfo)) | |||||
Defined in GHC.Iface.Ext.Ast Methods toHie :: IEContext (Located RecFieldInfo) -> HieM [HieAST Type] | |||||
| HiePass p => ToHie (Located (PatSynBind (GhcPass p) (GhcPass p))) | |||||
Defined in GHC.Iface.Ext.Ast Methods toHie :: Located (PatSynBind (GhcPass p) (GhcPass p)) -> HieM [HieAST Type] | |||||
| ToHie (Located [LocatedAn NoEpAnns (HsDerivingClause GhcRn)]) | |||||
Defined in GHC.Iface.Ext.Ast Methods toHie :: Located [LocatedAn NoEpAnns (HsDerivingClause GhcRn)] -> HieM [HieAST Type] | |||||
| HasHaddock (Located (HsModule GhcPs)) | |||||
Defined in GHC.Parser.PostProcess.Haddock Methods addHaddock :: Located (HsModule GhcPs) -> HdkA (Located (HsModule GhcPs)) | |||||
| HasHaddock (Located [LocatedAn NoEpAnns (HsDerivingClause GhcPs)]) | |||||
Defined in GHC.Parser.PostProcess.Haddock Methods addHaddock :: Located [LocatedAn NoEpAnns (HsDerivingClause GhcPs)] -> HdkA (Located [LocatedAn NoEpAnns (HsDerivingClause GhcPs)]) | |||||
| NamedThing e => NamedThing (Located e) | |||||
Defined in GHC.Types.Name | |||||
| Outputable e => Outputable (Located e) | |||||
Defined in GHC.Types.SrcLoc Methods ppr :: Located e -> SDoc | |||||
| (UnXRec p, Outputable (XRec p FieldLabelString)) => OutputableBndr (Located (FieldLabelStrings p)) | |||||
Defined in GHC.Hs.Expr Methods pprBndr :: BindingSite -> Located (FieldLabelStrings p) -> SDoc pprPrefixOcc :: Located (FieldLabelStrings p) -> SDoc pprInfixOcc :: Located (FieldLabelStrings p) -> SDoc bndrIsJoin_maybe :: Located (FieldLabelStrings p) -> JoinPointHood | |||||
| OutputableBndr (Located (AmbiguousFieldOcc (GhcPass p))) | |||||
Defined in GHC.Hs.Type Methods pprBndr :: BindingSite -> Located (AmbiguousFieldOcc (GhcPass p)) -> SDoc pprPrefixOcc :: Located (AmbiguousFieldOcc (GhcPass p)) -> SDoc pprInfixOcc :: Located (AmbiguousFieldOcc (GhcPass p)) -> SDoc bndrIsJoin_maybe :: Located (AmbiguousFieldOcc (GhcPass p)) -> JoinPointHood | |||||
| (UnXRec pass, OutputableBndr (XRec pass RdrName)) => OutputableBndr (GenLocated SrcSpan (FieldOcc pass)) | |||||
Defined in GHC.Hs.Type Methods pprBndr :: BindingSite -> GenLocated SrcSpan (FieldOcc pass) -> SDoc pprPrefixOcc :: GenLocated SrcSpan (FieldOcc pass) -> SDoc pprInfixOcc :: GenLocated SrcSpan (FieldOcc pass) -> SDoc bndrIsJoin_maybe :: GenLocated SrcSpan (FieldOcc pass) -> JoinPointHood | |||||
| type Rep SrcSpan | |||||
Defined in GHC.SrcLoc.Extra type Rep SrcSpan = D1 ('MetaData "SrcSpan" "GHC.Types.SrcLoc" "ghc-9.10.3-inplace" 'False) (C1 ('MetaCons "RealSrcSpan" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RealSrcSpan) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe BufSpan))) :+: C1 ('MetaCons "UnhelpfulSpan" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UnhelpfulSpanReason))) | |||||
hoistMaybe :: forall (m :: Type -> Type) b. Applicative m => Maybe b -> MaybeT m b #