I'm trying to refactor out the commented section below into its own function.
type Man = Object "Man" '[] '[Field "name" Text, Field "canVote" Bool]
type Dog = Object "Dog" '[] '[Field "name" Text, Field "hatesCats" Bool]
type ManOrDog = Object "Animal" '[]
'[Argument "num" Int32 :> Field "animal" (Union "ManOrDog" '[Man, Dog])]
manOrDog :: Int32 -> _
manOrDog num =
if num `mod` 2 == 0
then unionValue @Man $ pure (pure "Joe" :<> pure False)
else unionValue @Dog $ pure (pure "Rover" :<> pure True)
pickAnimal :: Handler IO ManOrDog
pickAnimal = pure manOrDog
-- where manOrDog num =
-- if num `mod` 2 == 0
-- then unionValue @Man $ pure (pure "Joe" :<> pure False)
-- else unionValue @Dog $ pure (pure "Rover" :<> pure True)
I'm trying to refactor out the commented section below into its own function.
According to the compiler, the
_
is:But
DynamicUnionValue
is NOT exported so this cannot be specified making the refactor impossible.