module Hydra.Impl.Haskell.Dsl.Literals where

import Hydra.All

import Data.Int


bigfloat :: Double -> Literal
bigfloat :: Double -> Literal
bigfloat = FloatValue -> Literal
float forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> FloatValue
FloatValueBigfloat

bigint :: Integer -> Literal
bigint :: Integer -> Literal
bigint = IntegerValue -> Literal
integer forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> IntegerValue
IntegerValueBigint forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral

binary :: String -> Literal
binary :: String -> Literal
binary = String -> Literal
LiteralBinary

boolean :: Bool -> Literal
boolean :: Bool -> Literal
boolean = Bool -> Literal
LiteralBoolean

expectBinary :: Literal -> Flow s String
expectBinary :: forall s. Literal -> Flow s String
expectBinary Literal
v = case Literal
v of
  LiteralBinary String
b -> forall (f :: * -> *) a. Applicative f => a -> f a
pure String
b
  Literal
_ -> forall (m :: * -> *) a1 a2.
(MonadFail m, Show a1) =>
String -> a1 -> m a2
unexpected String
"binary" Literal
v

expectBoolean :: Literal -> Flow s Bool
expectBoolean :: forall s. Literal -> Flow s Bool
expectBoolean Literal
v = case Literal
v of
  LiteralBoolean Bool
b -> forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
b
  Literal
_ -> forall (m :: * -> *) a1 a2.
(MonadFail m, Show a1) =>
String -> a1 -> m a2
unexpected String
"boolean" Literal
v

expectFloat32 :: Literal -> Flow s Float
expectFloat32 :: forall s. Literal -> Flow s Float
expectFloat32 Literal
v = case Literal
v of
  LiteralFloat (FloatValueFloat32 Float
f) -> forall (f :: * -> *) a. Applicative f => a -> f a
pure Float
f
  Literal
_ -> forall (m :: * -> *) a1 a2.
(MonadFail m, Show a1) =>
String -> a1 -> m a2
unexpected String
"float32" Literal
v

expectFloat64 :: Literal -> Flow s Double
expectFloat64 :: forall s. Literal -> Flow s Double
expectFloat64 Literal
v = case Literal
v of
  LiteralFloat (FloatValueFloat64 Double
f) -> forall (f :: * -> *) a. Applicative f => a -> f a
pure Double
f
  Literal
_ -> forall (m :: * -> *) a1 a2.
(MonadFail m, Show a1) =>
String -> a1 -> m a2
unexpected String
"float64" Literal
v

expectInt32 :: Literal -> Flow s Int
expectInt32 :: forall s. Literal -> Flow s Int
expectInt32 Literal
v = case Literal
v of
  LiteralInteger (IntegerValueInt32 Int
i) -> forall (f :: * -> *) a. Applicative f => a -> f a
pure Int
i
  Literal
_ -> forall (m :: * -> *) a1 a2.
(MonadFail m, Show a1) =>
String -> a1 -> m a2
unexpected String
"int32" Literal
v

expectInt64 :: Literal -> Flow s Integer
expectInt64 :: forall s. Literal -> Flow s Integer
expectInt64 Literal
v = case Literal
v of
  LiteralInteger (IntegerValueInt64 Integer
i) -> forall (f :: * -> *) a. Applicative f => a -> f a
pure Integer
i
  Literal
_ -> forall (m :: * -> *) a1 a2.
(MonadFail m, Show a1) =>
String -> a1 -> m a2
unexpected String
"int64" Literal
v

expectString :: Literal -> Flow s String
expectString :: forall s. Literal -> Flow s String
expectString Literal
v = case Literal
v of
  LiteralString String
s -> forall (f :: * -> *) a. Applicative f => a -> f a
pure String
s
  Literal
_ -> forall (m :: * -> *) a1 a2.
(MonadFail m, Show a1) =>
String -> a1 -> m a2
unexpected String
"string" Literal
v

float32 :: Float -> Literal
float32 :: Float -> Literal
float32 = FloatValue -> Literal
float forall b c a. (b -> c) -> (a -> b) -> a -> c
. Float -> FloatValue
FloatValueFloat32

float64 :: Double -> Literal
float64 :: Double -> Literal
float64 = FloatValue -> Literal
float forall b c a. (b -> c) -> (a -> b) -> a -> c
. Double -> FloatValue
FloatValueFloat64

float :: FloatValue -> Literal
float :: FloatValue -> Literal
float = FloatValue -> Literal
LiteralFloat

int16 :: Int16 -> Literal
int16 :: Int16 -> Literal
int16 = IntegerValue -> Literal
integer forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> IntegerValue
IntegerValueInt16 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral

int32 :: Int -> Literal
int32 :: Int -> Literal
int32 = IntegerValue -> Literal
integer forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> IntegerValue
IntegerValueInt32

int64 :: Int64 -> Literal
int64 :: Int64 -> Literal
int64 = IntegerValue -> Literal
integer forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> IntegerValue
IntegerValueInt64 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral

int8 :: Int8 -> Literal
int8 :: Int8 -> Literal
int8 = IntegerValue -> Literal
integer forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> IntegerValue
IntegerValueInt8 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral

integer :: IntegerValue -> Literal
integer :: IntegerValue -> Literal
integer = IntegerValue -> Literal
LiteralInteger

string :: String -> Literal
string :: String -> Literal
string = String -> Literal
LiteralString

uint16 :: Integer -> Literal
uint16 :: Integer -> Literal
uint16 = IntegerValue -> Literal
integer forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> IntegerValue
IntegerValueUint16 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral

uint32 :: Integer -> Literal
uint32 :: Integer -> Literal
uint32 = IntegerValue -> Literal
integer forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> IntegerValue
IntegerValueUint32 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral

uint64 :: Integer -> Literal
uint64 :: Integer -> Literal
uint64 = IntegerValue -> Literal
integer forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> IntegerValue
IntegerValueUint64 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral

uint8 :: Integer -> Literal
uint8 :: Integer -> Literal
uint8 = IntegerValue -> Literal
integer forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> IntegerValue
IntegerValueUint8 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral