Skip to content

FromDhall instance for Word8, Word16, Word32 #2007

Closed
@jchia

Description

@jchia

When reading a Dhall file into Haskell, often it is to a record type with fields that have limited precision, e.g. instead of Natural, the record type uses Word32 or even just Int.

In such cases, somewhere a validating conversion from Natural or Integer is needed, if not in Dhall.input itself then as a postprocessing step after that.

Double doesn't have this problem; one can read directly into Double instead of explicitly converting from Scientific to Double.

Would it make sense to add FromDhall instances for various common integral types Word8, Word16, Word32, Word64, Int8, Int16, Int32, Int64 & Int and let the range-check happen during input?

Metadata

Metadata

Assignees

No one assigned

    Labels

    marshallingMarshalling between Dhall and Haskell

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions