Add Inject instances for Word types (#112)
This commit is contained in:
parent
463126cb47
commit
a03de76a41
29
src/Dhall.hs
29
src/Dhall.hs
|
@ -60,6 +60,7 @@ import Data.Text.Buildable (Buildable(..))
|
|||
import Data.Text.Lazy (Text)
|
||||
import Data.Typeable (Typeable)
|
||||
import Data.Vector (Vector)
|
||||
import Data.Word (Word8, Word16, Word32, Word64)
|
||||
import Dhall.Core (Expr(..))
|
||||
import Dhall.Import (Imported(..))
|
||||
import Dhall.Parser (Src(..))
|
||||
|
@ -720,6 +721,34 @@ instance Inject Int where
|
|||
|
||||
declared = Integer
|
||||
|
||||
instance Inject Word8 where
|
||||
injectWith _ = InputType {..}
|
||||
where
|
||||
embed = IntegerLit . toInteger
|
||||
|
||||
declared = Integer
|
||||
|
||||
instance Inject Word16 where
|
||||
injectWith _ = InputType {..}
|
||||
where
|
||||
embed = IntegerLit . toInteger
|
||||
|
||||
declared = Integer
|
||||
|
||||
instance Inject Word32 where
|
||||
injectWith _ = InputType {..}
|
||||
where
|
||||
embed = IntegerLit . toInteger
|
||||
|
||||
declared = Integer
|
||||
|
||||
instance Inject Word64 where
|
||||
injectWith _ = InputType {..}
|
||||
where
|
||||
embed = IntegerLit . toInteger
|
||||
|
||||
declared = Integer
|
||||
|
||||
|
||||
instance Inject Double where
|
||||
injectWith _ = InputType {..}
|
||||
|
|
Loading…
Reference in New Issue
Block a user