I have not yet go through all codes, but it seems boilerpolate like
value :: AST.Value -> Text
value (AST.ValueVariable x _) = variable x
-- TODO: This will be replaced with `decimal` Buidler
value (AST.ValueInt x _) = pack $ show x
-- TODO: This will be replaced with `decimal` Buidler
value (AST.ValueFloat x _) = pack $ show x
value (AST.ValueBoolean x _) = booleanValue x
value (AST.ValueString x _) = stringValue x
can be simplified via
converter :: (Int -> r ) -> (Float -> r) -> (Boolean -> r) -> (value -> r) -> value -> r
converter f _ _ .. (ValueInt v ..) = ValueInt (f v) ....
value = converter ....
It seems we can use this converter in many places related to AST.Value or Internal.Value
I have not yet go through all codes, but it seems boilerpolate like
can be simplified via
It seems we can use this
converter
in many places related to AST.Value or Internal.Value