clash-lib-1.2.5: CAES Language for Synchronous Hardware - As a Library
Copyright(C) 2019 Myrtle Software Ltd
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <christiaan.baaij@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Clash.Core.TermLiteral

Description

Tools to convert a Term into its "real" representation

Synopsis

Documentation

class TermLiteral a Source #

Tools to deal with literals encoded as a Term.

Minimal complete definition

termToData

Instances

Instances details
TermLiteral Bool Source # 
Instance details

Defined in Clash.Core.TermLiteral

TermLiteral Char Source # 
Instance details

Defined in Clash.Core.TermLiteral

TermLiteral Int Source # 
Instance details

Defined in Clash.Core.TermLiteral

TermLiteral Integer Source # 
Instance details

Defined in Clash.Core.TermLiteral

TermLiteral Natural Source # 
Instance details

Defined in Clash.Core.TermLiteral

TermLiteral String Source # 
Instance details

Defined in Clash.Core.TermLiteral

TermLiteral Text Source # 
Instance details

Defined in Clash.Core.TermLiteral

TermLiteral Term Source # 
Instance details

Defined in Clash.Core.TermLiteral

TermLiteral a => TermLiteral (Maybe a) Source # 
Instance details

Defined in Clash.Core.TermLiteral

(TermLiteral a, TermLiteral b) => TermLiteral (a, b) Source # 
Instance details

Defined in Clash.Core.TermLiteral

Methods

termToData :: Term -> Either Term (a, b) Source #

termToData Source #

Arguments

:: (TermLiteral a, HasCallStack) 
=> Term

Term to convert

-> Either Term a

Left indicates a failure, containing the (sub)term that failed to translate. Right indicates a success.

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.