Copyright | (C) 2019 Myrtle Software Ltd |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Tools to convert a Term
into its "real" representation
Synopsis
- class TermLiteral a
- termToData :: (TermLiteral a, HasCallStack) => Term -> Either Term a
- termToDataError :: TermLiteral a => Term -> Either String a
- uncheckedTermToData :: TermLiteral a => Term -> a
Documentation
class TermLiteral a Source #
Tools to deal with literals encoded as a Term.
Instances
TermLiteral Bool Source # | |
Defined in Clash.Core.TermLiteral | |
TermLiteral Char Source # | |
Defined in Clash.Core.TermLiteral | |
TermLiteral Int Source # | |
Defined in Clash.Core.TermLiteral | |
TermLiteral Integer Source # | |
Defined in Clash.Core.TermLiteral | |
TermLiteral Natural Source # | |
Defined in Clash.Core.TermLiteral | |
TermLiteral String Source # | |
Defined in Clash.Core.TermLiteral | |
TermLiteral Text Source # | |
Defined in Clash.Core.TermLiteral | |
TermLiteral Term Source # | |
Defined in Clash.Core.TermLiteral | |
TermLiteral a => TermLiteral (Maybe a) Source # | |
Defined in Clash.Core.TermLiteral | |
(TermLiteral a, TermLiteral b) => TermLiteral (a, b) Source # | |
Defined in Clash.Core.TermLiteral |
:: (TermLiteral a, HasCallStack) | |
=> Term | Term to convert |
-> Either Term a |
|
Convert Term
to the constant it represents. Will return an error if
(one of the subterms) fail to translate.
termToDataError :: TermLiteral a => Term -> Either String a Source #
Same as termToData
, but returns printable error message if it couldn't
translate a term.
uncheckedTermToData :: TermLiteral a => Term -> a Source #
Same as termToData
, but errors hard if it can't translate a given term
to data.