module Data.Express.Fixtures
(
module Data.Express
, b_, pp, qq, rr, pp'
, false
, true
, notE
, orE
, andE
, implies
, not'
, (-||-)
, (-&&-)
, (-==>-)
, (-==-)
, (-/=-)
, (-<=-)
, (-<-)
, compare'
, if'
, caseBool
, caseOrdering
, i_, xx, yy, zz, xx'
, ii, jj, kk, ii'
, ll, mm, nn
, zero, one, two, three, four, five, six
, seven, eight, nine, ten, eleven, twelve
, minusOne, minusTwo
, idE, negateE, absE, signumE
, idInt
, idBool
, idChar
, idInts
, idBools
, idString
, id', const', negate', abs', signum'
, plus, times, minus
, (-+-), (-*-)
, divE, modE, quotE, remE
, div', mod', quot', rem'
, ff, ffE
, gg, ggE
, hh, hhE
, oo, ooE
, question
, (-?-)
, (-$-)
, odd'
, even'
, c_, cs_
, cc, dd, ccs
, ae, bee, cee, dee, zed, zee
, space, lineBreak
, ord'
, ordE
, is_
, xxs
, yys
, zzs
, nil
, emptyString
, nilInt
, nilBool
, nilChar
, cons
, consInt
, consBool
, consChar
, (-:-)
, unit
, (-++-)
, head'
, tail'
, null'
, length'
, init'
, elem'
, sort'
, insert'
, bs_, pps, qqs
, and', or'
, sum', product'
, appendInt
, nothing
, nothingInt
, nothingBool
, just
, justInt
, justBool
, comma
, pair
, (-|-)
, triple
, quadruple
, quintuple
, sixtuple
, (-%-)
, compose
, mapE
, (-.-)
, map'
, enumFrom', (-..)
, enumFromTo', (-..-)
, enumFromThen', (-...)
, enumFromThenTo', (-...-)
)
where
import Data.Express
import Data.Maybe
import Data.Typeable (Typeable, typeOf)
import Data.Char
import Data.List
import Data.Ratio
int :: Int
int :: Int
int = forall a. HasCallStack => a
undefined
bool :: Bool
bool :: Bool
bool = forall a. HasCallStack => a
undefined
char :: Char
char :: Char
char = forall a. HasCallStack => a
undefined
string :: String
string :: [Char]
string = forall a. HasCallStack => a
undefined
b_ :: Expr
b_ :: Expr
b_ = forall a. Typeable a => a -> Expr
hole Bool
bool
pp :: Expr
pp :: Expr
pp = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"p" Bool
bool
qq :: Expr
qq :: Expr
qq = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"q" Bool
bool
rr :: Expr
rr :: Expr
rr = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"r" Bool
bool
pp' :: Expr
pp' :: Expr
pp' = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"p'" Bool
bool
false :: Expr
false :: Expr
false = forall a. (Typeable a, Show a) => a -> Expr
val Bool
False
true :: Expr
true :: Expr
true = forall a. (Typeable a, Show a) => a -> Expr
val Bool
True
notE :: Expr
notE :: Expr
notE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"not" Id Bool
not
andE :: Expr
andE :: Expr
andE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"&&" Comparison Bool
(&&)
orE :: Expr
orE :: Expr
orE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"||" Comparison Bool
(||)
(-==>-) :: Expr -> Expr -> Expr
Expr
e1 -==>- :: Expr -> Expr -> Expr
-==>- Expr
e2 = Expr
implies Expr -> Expr -> Expr
:$ Expr
e1 Expr -> Expr -> Expr
:$ Expr
e2
infixr 0 -==>-
implies :: Expr
implies :: Expr
implies = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"==>" Comparison Bool
(==>)
where
Bool
False ==> :: Comparison Bool
==> Bool
_ = Bool
True
Bool
True ==> Bool
p = Bool
p
not' :: Expr -> Expr
not' :: Expr -> Expr
not' Expr
pp = Expr
notE Expr -> Expr -> Expr
:$ Expr
pp
(-&&-) :: Expr -> Expr -> Expr
Expr
pp -&&- :: Expr -> Expr -> Expr
-&&- Expr
qq = Expr
andE Expr -> Expr -> Expr
:$ Expr
pp Expr -> Expr -> Expr
:$ Expr
qq
infixr 3 -&&-
(-||-) :: Expr -> Expr -> Expr
Expr
pp -||- :: Expr -> Expr -> Expr
-||- Expr
qq = Expr
orE Expr -> Expr -> Expr
:$ Expr
pp Expr -> Expr -> Expr
:$ Expr
qq
infixr 2 -||-
i_ :: Expr
i_ :: Expr
i_ = forall a. Typeable a => a -> Expr
hole Int
int
xx :: Expr
xx :: Expr
xx = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"x" Int
int
yy :: Expr
yy :: Expr
yy = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"y" Int
int
zz :: Expr
zz :: Expr
zz = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"z" Int
int
xx' :: Expr
xx' :: Expr
xx' = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"x'" Int
int
ii :: Expr
ii :: Expr
ii = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"i" Int
int
jj :: Expr
jj :: Expr
jj = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"j" Int
int
kk :: Expr
kk :: Expr
kk = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"k" Int
int
ii' :: Expr
ii' :: Expr
ii' = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"i'" Int
int
ll :: Expr
ll :: Expr
ll = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"l" Int
int
mm :: Expr
mm :: Expr
mm = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"m" Int
int
nn :: Expr
nn :: Expr
nn = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"n" Int
int
zero :: Expr
zero :: Expr
zero = forall a. (Typeable a, Show a) => a -> Expr
val (Int
0 :: Int)
one :: Expr
one :: Expr
one = forall a. (Typeable a, Show a) => a -> Expr
val (Int
1 :: Int)
two :: Expr
two :: Expr
two = forall a. (Typeable a, Show a) => a -> Expr
val (Int
2 :: Int)
three :: Expr
three :: Expr
three = forall a. (Typeable a, Show a) => a -> Expr
val (Int
3 :: Int)
four :: Expr
four :: Expr
four = forall a. (Typeable a, Show a) => a -> Expr
val (Int
4 :: Int)
five :: Expr
five :: Expr
five = forall a. (Typeable a, Show a) => a -> Expr
val (Int
5 :: Int)
six :: Expr
six :: Expr
six = forall a. (Typeable a, Show a) => a -> Expr
val (Int
6 :: Int)
seven :: Expr
seven :: Expr
seven = forall a. (Typeable a, Show a) => a -> Expr
val (Int
7 :: Int)
eight :: Expr
eight :: Expr
eight = forall a. (Typeable a, Show a) => a -> Expr
val (Int
8 :: Int)
nine :: Expr
nine :: Expr
nine = forall a. (Typeable a, Show a) => a -> Expr
val (Int
9 :: Int)
ten :: Expr
ten :: Expr
ten = forall a. (Typeable a, Show a) => a -> Expr
val (Int
10 :: Int)
eleven :: Expr
eleven :: Expr
eleven = forall a. (Typeable a, Show a) => a -> Expr
val (Int
11 :: Int)
twelve :: Expr
twelve :: Expr
twelve = forall a. (Typeable a, Show a) => a -> Expr
val (Int
12 :: Int)
minusOne :: Expr
minusOne :: Expr
minusOne = forall a. (Typeable a, Show a) => a -> Expr
val (-Int
1 :: Int)
minusTwo :: Expr
minusTwo :: Expr
minusTwo = forall a. (Typeable a, Show a) => a -> Expr
val (-Int
2 :: Int)
ff :: Expr -> Expr
ff :: Expr -> Expr
ff = (Expr
ffE Expr -> Expr -> Expr
:$)
ffE :: Expr
ffE :: Expr
ffE = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"f" (forall a. HasCallStack => a
undefined :: Int -> Int)
gg :: Expr -> Expr
gg :: Expr -> Expr
gg = (Expr
ggE Expr -> Expr -> Expr
:$)
ggE :: Expr
ggE :: Expr
ggE = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"g" (forall a. HasCallStack => a
undefined :: Int -> Int)
hh :: Expr -> Expr
hh :: Expr -> Expr
hh = (Expr
hhE Expr -> Expr -> Expr
:$)
hhE :: Expr
hhE :: Expr
hhE = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"h" (forall a. HasCallStack => a
undefined :: Int -> Int)
(-?-) :: Expr -> Expr -> Expr
Expr
ex -?- :: Expr -> Expr -> Expr
-?- Expr
ey = forall a. a -> Maybe a -> a
fromMaybe forall {a}. a
err forall a b. (a -> b) -> a -> b
$ (Expr -> Expr -> Maybe Expr
$$ Expr
ey) forall a b. (a -> b) -> a -> b
$ forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"?" (forall a. HasCallStack => a
undefined :: Int -> Int -> Int)
, forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"?" (forall a. HasCallStack => a
undefined :: Bool -> Bool -> Bool)
, forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"?" (forall a. HasCallStack => a
undefined :: Char -> Char -> Char)
, forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"?" (forall a. HasCallStack => a
undefined :: [Int] -> [Int] -> [Int])
, forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"?" (forall a. HasCallStack => a
undefined :: String -> String -> String)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"(-?-): cannot apply `(?) :: * -> * -> *` to `"
forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show Expr
ex forall a. [a] -> [a] -> [a]
++ [Char]
"' and `" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show Expr
ey forall a. [a] -> [a] -> [a]
++ [Char]
"'. Unhandled types?"
question :: Expr
question :: Expr
question = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"?" (forall a. HasCallStack => a
undefined :: Int -> Int -> Int)
oo :: Expr -> Expr -> Expr
Expr
ex oo :: Expr -> Expr -> Expr
`oo` Expr
ey = forall a. a -> Maybe a -> a
fromMaybe forall {a}. a
err forall a b. (a -> b) -> a -> b
$ (Expr -> Expr -> Maybe Expr
$$ Expr
ey) forall a b. (a -> b) -> a -> b
$ forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"`o`" (forall a. HasCallStack => a
undefined :: Int -> Int -> Int)
, forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"`o`" (forall a. HasCallStack => a
undefined :: Bool -> Bool -> Bool)
, forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"`o`" (forall a. HasCallStack => a
undefined :: Char -> Char -> Char)
, forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"`o`" (forall a. HasCallStack => a
undefined :: [Int] -> [Int] -> [Int])
, forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"`o`" (forall a. HasCallStack => a
undefined :: String -> String -> String)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"oo: cannot apply `o :: * -> * -> *` to `"
forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show Expr
ex forall a. [a] -> [a] -> [a]
++ [Char]
"' and `" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show Expr
ey forall a. [a] -> [a] -> [a]
++ [Char]
"'. Unhandled types?"
ooE :: Expr
ooE :: Expr
ooE = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"`o`" (forall a. HasCallStack => a
undefined :: Int -> Int -> Int)
(-+-) :: Expr -> Expr -> Expr
Expr
e1 -+- :: Expr -> Expr -> Expr
-+- Expr
e2 = Expr
plus Expr -> Expr -> Expr
:$ Expr
e1 Expr -> Expr -> Expr
:$ Expr
e2
infixl 6 -+-
plus :: Expr
plus :: Expr
plus = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"+" (forall a. Num a => a -> a -> a
(+) :: Int -> Int -> Int)
(-*-) :: Expr -> Expr -> Expr
Expr
e1 -*- :: Expr -> Expr -> Expr
-*- Expr
e2 = Expr
times Expr -> Expr -> Expr
:$ Expr
e1 Expr -> Expr -> Expr
:$ Expr
e2
infixl 7 -*-
times :: Expr
times :: Expr
times = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"*" (forall a. Num a => a -> a -> a
(*) :: Int -> Int -> Int)
minus :: Expr
minus :: Expr
minus = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"-" ((-) :: Int -> Int -> Int)
div' :: Expr -> Expr -> Expr
Expr
ex div' :: Expr -> Expr -> Expr
`div'` Expr
ey = Expr
divE Expr -> Expr -> Expr
:$ Expr
ex Expr -> Expr -> Expr
:$ Expr
ey
divE :: Expr
divE :: Expr
divE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"`div`" (forall a. Integral a => a -> a -> a
div :: Int -> Int -> Int)
mod' :: Expr -> Expr -> Expr
Expr
ex mod' :: Expr -> Expr -> Expr
`mod'` Expr
ey = Expr
modE Expr -> Expr -> Expr
:$ Expr
ex Expr -> Expr -> Expr
:$ Expr
ey
modE :: Expr
modE :: Expr
modE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"`mod`" (forall a. Integral a => a -> a -> a
mod :: Int -> Int -> Int)
quot' :: Expr -> Expr -> Expr
Expr
ex quot' :: Expr -> Expr -> Expr
`quot'` Expr
ey = Expr
quotE Expr -> Expr -> Expr
:$ Expr
ex Expr -> Expr -> Expr
:$ Expr
ey
quotE :: Expr
quotE :: Expr
quotE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"`quot`" (forall a. Integral a => a -> a -> a
quot :: Int -> Int -> Int)
rem' :: Expr -> Expr -> Expr
Expr
ex rem' :: Expr -> Expr -> Expr
`rem'` Expr
ey = Expr
remE Expr -> Expr -> Expr
:$ Expr
ex Expr -> Expr -> Expr
:$ Expr
ey
remE :: Expr
remE :: Expr
remE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"`rem`" (forall a. Integral a => a -> a -> a
rem :: Int -> Int -> Int)
id' :: Expr -> Expr
id' :: Expr -> Expr
id' Expr
e = forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
e)
[ Expr
idInt
, Expr
idBool
, Expr
idChar
, Expr
idInts
, Expr
idBools
, Expr
idString
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"id': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
e)
idE :: Expr
idE :: Expr
idE = Expr
idInt
idInt,idBool,idChar,idInts,idBools,idString :: Expr
idInt :: Expr
idInt = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"id" (forall a. a -> a
id :: Id Int)
idBool :: Expr
idBool = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"id" (forall a. a -> a
id :: Id Bool)
idChar :: Expr
idChar = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"id" (forall a. a -> a
id :: Id Char)
idInts :: Expr
idInts = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"id" (forall a. a -> a
id :: Id [Int])
idBools :: Expr
idBools = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"id" (forall a. a -> a
id :: Id [Bool])
idString :: Expr
idString = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"id" (forall a. a -> a
id :: Id String)
type Id a = a -> a
const' :: Expr -> Expr -> Expr
const' :: Expr -> Expr -> Expr
const' Expr
e1 Expr
e2 = (Expr -> Expr -> Expr
:$ Expr
e2) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
e1)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"const" (forall a b. a -> b -> a
const :: Int -> Int -> Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"const" (forall a b. a -> b -> a
const :: Bool -> Bool -> Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"const" (forall a b. a -> b -> a
const :: Char -> Char -> Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"const" (forall a b. a -> b -> a
const :: [Int] -> [Int] -> [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"const" (forall a b. a -> b -> a
const :: [Bool] -> [Bool] -> [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"const" (forall a b. a -> b -> a
const :: String -> String -> String)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"const': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
e1)
negate' :: Expr -> Expr
negate' :: Expr -> Expr
negate' Expr
e = Expr
negateE Expr -> Expr -> Expr
:$ Expr
e
negateE :: Expr
negateE :: Expr
negateE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"negate" (forall a. Num a => a -> a
negate :: Int -> Int)
abs' :: Expr -> Expr
abs' :: Expr -> Expr
abs' Expr
e = Expr
absE Expr -> Expr -> Expr
:$ Expr
e
absE :: Expr
absE :: Expr
absE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"abs" (forall a. Num a => a -> a
abs :: Int -> Int)
signum' :: Expr -> Expr
signum' :: Expr -> Expr
signum' Expr
e = Expr
signumE Expr -> Expr -> Expr
:$ Expr
e
signumE :: Expr
signumE :: Expr
signumE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"signum" (forall a. Num a => a -> a
signum :: Int -> Int)
odd' :: Expr -> Expr
odd' :: Expr -> Expr
odd' = (Expr
oddE Expr -> Expr -> Expr
:$) where oddE :: Expr
oddE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"odd" (forall a. Integral a => a -> Bool
odd :: Int -> Bool)
even' :: Expr -> Expr
even' :: Expr -> Expr
even' = (Expr
evenE Expr -> Expr -> Expr
:$) where evenE :: Expr
evenE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"even" (forall a. Integral a => a -> Bool
even :: Int -> Bool)
c_ :: Expr
c_ :: Expr
c_ = forall a. Typeable a => a -> Expr
hole Char
char
cs_ :: Expr
cs_ :: Expr
cs_ = forall a. Typeable a => a -> Expr
hole [Char
char]
cc :: Expr
cc :: Expr
cc = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"c" Char
char
dd :: Expr
dd :: Expr
dd = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"d" Char
char
ccs :: Expr
ccs :: Expr
ccs = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"cs" [Char
char]
ae :: Expr
ae :: Expr
ae = forall a. (Typeable a, Show a) => a -> Expr
val Char
'a'
bee :: Expr
bee :: Expr
bee = forall a. (Typeable a, Show a) => a -> Expr
val Char
'b'
cee :: Expr
cee :: Expr
cee = forall a. (Typeable a, Show a) => a -> Expr
val Char
'c'
dee :: Expr
dee :: Expr
dee = forall a. (Typeable a, Show a) => a -> Expr
val Char
'd'
zed :: Expr
zed :: Expr
zed = forall a. (Typeable a, Show a) => a -> Expr
val Char
'z'
zee :: Expr
zee :: Expr
zee = forall a. (Typeable a, Show a) => a -> Expr
val Char
'z'
space :: Expr
space :: Expr
space = forall a. (Typeable a, Show a) => a -> Expr
val Char
' '
lineBreak :: Expr
lineBreak :: Expr
lineBreak = forall a. (Typeable a, Show a) => a -> Expr
val Char
'\n'
ord' :: Expr -> Expr
ord' :: Expr -> Expr
ord' = (Expr
ordE Expr -> Expr -> Expr
:$)
ordE :: Expr
ordE :: Expr
ordE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"ord" Char -> Int
ord
is_ :: Expr
is_ :: Expr
is_ = forall a. Typeable a => a -> Expr
hole [Int
int]
xxs :: Expr
xxs :: Expr
xxs = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"xs" [Int
int]
yys :: Expr
yys :: Expr
yys = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"ys" [Int
int]
zzs :: Expr
zzs :: Expr
zzs = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"zs" [Int
int]
nil :: Expr
nil :: Expr
nil = Expr
nilInt
emptyString :: Expr
emptyString :: Expr
emptyString = forall a. (Typeable a, Show a) => a -> Expr
val [Char]
""
nilInt, nilBool, nilChar :: Expr
nilInt :: Expr
nilInt = forall a. (Typeable a, Show a) => a -> Expr
val ([] :: [Int])
nilBool :: Expr
nilBool = forall a. (Typeable a, Show a) => a -> Expr
val ([] :: [Bool])
nilChar :: Expr
nilChar = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"[]" ([] :: [Char])
cons :: Expr
cons :: Expr
cons = Expr
consInt
consInt, consBool, consChar :: Expr
consInt :: Expr
consInt = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
":" ((:) :: Cons Int)
consBool :: Expr
consBool = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
":" ((:) :: Cons Bool)
consChar :: Expr
consChar = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
":" ((:) :: Cons Char)
type Cons a = a -> [a] -> [a]
unit :: Expr -> Expr
unit :: Expr -> Expr
unit Expr
e = Expr
e Expr -> Expr -> Expr
-:- Expr
nil'
where
nil' :: Expr
nil' | Expr -> TypeRep
typ Expr
e forall a. Eq a => a -> a -> Bool
== Expr -> TypeRep
typ Expr
i_ = Expr
nil
| Expr -> TypeRep
typ Expr
e forall a. Eq a => a -> a -> Bool
== Expr -> TypeRep
typ Expr
c_ = Expr
emptyString
| Expr -> TypeRep
typ Expr
e forall a. Eq a => a -> a -> Bool
== Expr -> TypeRep
typ Expr
b_ = Expr
nilBool
(-:-) :: Expr -> Expr -> Expr
Expr
e1 -:- :: Expr -> Expr -> Expr
-:- Expr
e2 = (Expr -> Expr -> Expr
:$ Expr
e2) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
e1)
[ Expr
consInt
, Expr
consBool
, Expr
consChar
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
":" ((:) :: Cons (Maybe Int))
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"(-:-): unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
e1)
infixr 5 -:-
appendInt :: Expr
appendInt :: Expr
appendInt = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"++" (forall a. [a] -> [a] -> [a]
(++) :: [Int] -> [Int] -> [Int])
(-++-) :: Expr -> Expr -> Expr
Expr
e1 -++- :: Expr -> Expr -> Expr
-++- Expr
e2 = (Expr -> Expr -> Expr
:$ Expr
e2) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
e1)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"++" (forall a. [a] -> [a] -> [a]
(++) :: [Int] -> [Int] -> [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"++" (forall a. [a] -> [a] -> [a]
(++) :: String -> String -> String)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"++" (forall a. [a] -> [a] -> [a]
(++) :: [Bool] -> [Bool] -> [Bool])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"(-++-): unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
e1)
infixr 5 -++-
head' :: Expr -> Expr
head' :: Expr -> Expr
head' Expr
exs = forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
exs)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"head" (forall a. [a] -> a
head :: [Int] -> Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"head" (forall a. [a] -> a
head :: [Char] -> Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"head" (forall a. [a] -> a
head :: [Bool] -> Bool)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"head': cannot apply `head :: [a] -> a` to `" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show Expr
exs forall a. [a] -> [a] -> [a]
++ [Char]
"'."
tail' :: Expr -> Expr
tail' :: Expr -> Expr
tail' Expr
exs = forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
exs)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"tail" (forall a. [a] -> [a]
tail :: [Int] -> [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"tail" (forall a. [a] -> [a]
tail :: [Char] -> [Char])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"tail" (forall a. [a] -> [a]
tail :: [Bool] -> [Bool])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"tail': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
exs)
null' :: Expr -> Expr
null' :: Expr -> Expr
null' Expr
exs = forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
exs)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"null" (forall (t :: * -> *) a. Foldable t => t a -> Bool
null :: [Int] -> Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"null" (forall (t :: * -> *) a. Foldable t => t a -> Bool
null :: [Char] -> Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"null" (forall (t :: * -> *) a. Foldable t => t a -> Bool
null :: [Bool] -> Bool)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"null': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
exs)
length' :: Expr -> Expr
length' :: Expr -> Expr
length' Expr
exs = forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
exs)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"length" (forall (t :: * -> *) a. Foldable t => t a -> Int
length :: [Int] -> Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"length" (forall (t :: * -> *) a. Foldable t => t a -> Int
length :: [Char] -> Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"length" (forall (t :: * -> *) a. Foldable t => t a -> Int
length :: [Bool] -> Int)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"length': cannot apply `length :: [a] -> a` to `" forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show Expr
exs forall a. [a] -> [a] -> [a]
++ [Char]
"'."
init' :: Expr -> Expr
init' :: Expr -> Expr
init' Expr
exs = forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
exs)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"init" (forall a. [a] -> [a]
init :: [Int] -> [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"init" (forall a. [a] -> [a]
init :: [Char] -> [Char])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"init" (forall a. [a] -> [a]
init :: [Bool] -> [Bool])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"init': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
exs)
sort' :: Expr -> Expr
sort' :: Expr -> Expr
sort' Expr
exs = forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
exs)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"sort" (forall a. Ord a => [a] -> [a]
sort :: [Int] -> [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"sort" (forall a. Ord a => [a] -> [a]
sort :: [Char] -> [Char])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"sort" (forall a. Ord a => [a] -> [a]
sort :: [Bool] -> [Bool])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"sort': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
exs)
insert' :: Expr -> Expr -> Expr
insert' :: Expr -> Expr -> Expr
insert' Expr
ex Expr
exs = (Expr -> Expr -> Expr
:$ Expr
exs) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"insert" (forall a. Ord a => a -> [a] -> [a]
insert :: Int -> [Int] -> [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"insert" (forall a. Ord a => a -> [a] -> [a]
insert :: Bool -> [Bool] -> [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"insert" (forall a. Ord a => a -> [a] -> [a]
insert :: Char -> String -> String)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"insert': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
elem' :: Expr -> Expr -> Expr
elem' :: Expr -> Expr -> Expr
elem' Expr
ex Expr
exs = (Expr -> Expr -> Expr
:$ Expr
exs) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"elem" (forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
elem :: Int -> [Int] -> Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"elem" (forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
elem :: Bool -> [Bool] -> Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"elem" (forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
elem :: Char -> String -> Bool)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"elem': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
(-$-) :: Expr -> Expr -> Expr
Expr
ef -$- :: Expr -> Expr -> Expr
-$- Expr
ex = (Expr -> Expr -> Expr
:$ Expr
ex) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ef)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"$" (forall a b. (a -> b) -> a -> b
($) :: Apply Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"$" (forall a b. (a -> b) -> a -> b
($) :: Apply Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"$" (forall a b. (a -> b) -> a -> b
($) :: Apply Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"$" (forall a b. (a -> b) -> a -> b
($) :: Apply [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"$" (forall a b. (a -> b) -> a -> b
($) :: Apply [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"$" (forall a b. (a -> b) -> a -> b
($) :: Apply [Char])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"(-$-): unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ef)
infixl 6 -$-
type Apply a = (a -> a) -> a -> a
(-==-) :: Expr -> Expr -> Expr
Expr
ex -==- :: Expr -> Expr -> Expr
-==- Expr
ey = (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"==" (forall a. Eq a => a -> a -> Bool
(==) :: Comparison ())
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"==" (forall a. Eq a => a -> a -> Bool
(==) :: Comparison Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"==" (forall a. Eq a => a -> a -> Bool
(==) :: Comparison Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"==" (forall a. Eq a => a -> a -> Bool
(==) :: Comparison Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"==" (forall a. Eq a => a -> a -> Bool
(==) :: Comparison [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"==" (forall a. Eq a => a -> a -> Bool
(==) :: Comparison [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"==" (forall a. Eq a => a -> a -> Bool
(==) :: Comparison [Char])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"(-==-): unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
infix 4 -==-
type Comparison a = a -> a -> Bool
(-/=-) :: Expr -> Expr -> Expr
Expr
ex -/=- :: Expr -> Expr -> Expr
-/=- Expr
ey = (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"/=" (forall a. Eq a => a -> a -> Bool
(/=) :: Comparison ())
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"/=" (forall a. Eq a => a -> a -> Bool
(/=) :: Comparison Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"/=" (forall a. Eq a => a -> a -> Bool
(/=) :: Comparison Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"/=" (forall a. Eq a => a -> a -> Bool
(/=) :: Comparison Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"/=" (forall a. Eq a => a -> a -> Bool
(/=) :: Comparison [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"/=" (forall a. Eq a => a -> a -> Bool
(/=) :: Comparison [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"/=" (forall a. Eq a => a -> a -> Bool
(/=) :: Comparison [Char])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"(-/=-): unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
infix 4 -/=-
(-<=-) :: Expr -> Expr -> Expr
Expr
ex -<=- :: Expr -> Expr -> Expr
-<=- Expr
ey = (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<=" (forall a. Ord a => a -> a -> Bool
(<=) :: Comparison ())
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<=" (forall a. Ord a => a -> a -> Bool
(<=) :: Comparison Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<=" (forall a. Ord a => a -> a -> Bool
(<=) :: Comparison Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<=" (forall a. Ord a => a -> a -> Bool
(<=) :: Comparison Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<=" (forall a. Ord a => a -> a -> Bool
(<=) :: Comparison [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<=" (forall a. Ord a => a -> a -> Bool
(<=) :: Comparison [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<=" (forall a. Ord a => a -> a -> Bool
(<=) :: Comparison [Char])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"(-<=-): unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
infix 4 -<=-
(-<-) :: Expr -> Expr -> Expr
Expr
ex -<- :: Expr -> Expr -> Expr
-<- Expr
ey = (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<" (forall a. Ord a => a -> a -> Bool
(<) :: Comparison ())
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<" (forall a. Ord a => a -> a -> Bool
(<) :: Comparison Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<" (forall a. Ord a => a -> a -> Bool
(<) :: Comparison Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<" (forall a. Ord a => a -> a -> Bool
(<) :: Comparison Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<" (forall a. Ord a => a -> a -> Bool
(<) :: Comparison [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<" (forall a. Ord a => a -> a -> Bool
(<) :: Comparison [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"<" (forall a. Ord a => a -> a -> Bool
(<) :: Comparison [Char])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"(-<-): unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
infix 4 -<-
if' :: Expr -> Expr -> Expr -> Expr
if' :: Expr -> Expr -> Expr -> Expr
if' Expr
ep Expr
ex Expr
ey = (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex) forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map (Expr -> Expr -> Expr
:$ Expr
ep)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"if" (forall a. Bool -> a -> a -> a
iff :: If ())
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"if" (forall a. Bool -> a -> a -> a
iff :: If Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"if" (forall a. Bool -> a -> a -> a
iff :: If Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"if" (forall a. Bool -> a -> a -> a
iff :: If Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"if" (forall a. Bool -> a -> a -> a
iff :: If [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"if" (forall a. Bool -> a -> a -> a
iff :: If [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"if" (forall a. Bool -> a -> a -> a
iff :: If [Char])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"if': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
iff :: Bool -> a -> a -> a
iff :: forall a. Bool -> a -> a -> a
iff Bool
p a
x a
y = if Bool
p then a
x else a
y
type If a = Bool -> a -> a -> a
caseBool :: Expr -> Expr -> Expr -> Expr
caseBool :: Expr -> Expr -> Expr -> Expr
caseBool Expr
ep Expr
ex Expr
ey = (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex) forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map (Expr -> Expr -> Expr
:$ Expr
ep)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Bool -> a -> a -> a
caseB :: CaseB ())
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Bool -> a -> a -> a
caseB :: CaseB Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Bool -> a -> a -> a
caseB :: CaseB Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Bool -> a -> a -> a
caseB :: CaseB Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Bool -> a -> a -> a
caseB :: CaseB [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Bool -> a -> a -> a
caseB :: CaseB [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Bool -> a -> a -> a
caseB :: CaseB [Char])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"caseBool: unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
caseB :: Bool -> a -> a -> a
caseB :: forall a. Bool -> a -> a -> a
caseB Bool
p a
x a
y = case Bool
p of
Bool
False -> a
x
Bool
True -> a
y
type CaseB a = Bool -> a -> a -> a
caseOrdering :: Expr -> Expr -> Expr -> Expr -> Expr
caseOrdering :: Expr -> Expr -> Expr -> Expr -> Expr
caseOrdering Expr
eo Expr
ex Expr
ey Expr
ez = (Expr -> Expr -> Expr
:$ Expr
ez) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex) forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map (Expr -> Expr -> Expr
:$ Expr
eo)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Ordering -> a -> a -> a -> a
caseO :: CaseO ())
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Ordering -> a -> a -> a -> a
caseO :: CaseO Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Ordering -> a -> a -> a -> a
caseO :: CaseO Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Ordering -> a -> a -> a -> a
caseO :: CaseO Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Ordering -> a -> a -> a -> a
caseO :: CaseO [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Ordering -> a -> a -> a -> a
caseO :: CaseO [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"case" (forall a. Ordering -> a -> a -> a -> a
caseO :: CaseO [Char])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"caseOrdering: unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
caseO :: Ordering -> a -> a -> a -> a
caseO :: forall a. Ordering -> a -> a -> a -> a
caseO Ordering
o a
x a
y a
z = case Ordering
o of
Ordering
LT -> a
x
Ordering
EQ -> a
y
Ordering
GT -> a
z
type CaseO a = Ordering -> a -> a -> a -> a
compare' :: Expr -> Expr -> Expr
compare' :: Expr -> Expr -> Expr
compare' Expr
ex Expr
ey = (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"compare" (forall a. Ord a => a -> a -> Ordering
compare :: Compare ())
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"compare" (forall a. Ord a => a -> a -> Ordering
compare :: Compare Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"compare" (forall a. Ord a => a -> a -> Ordering
compare :: Compare Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"compare" (forall a. Ord a => a -> a -> Ordering
compare :: Compare Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"compare" (forall a. Ord a => a -> a -> Ordering
compare :: Compare [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"compare" (forall a. Ord a => a -> a -> Ordering
compare :: Compare [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"compare" (forall a. Ord a => a -> a -> Ordering
compare :: Compare [Char])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"(-<-): unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
type Compare a = a -> a -> Ordering
nothing :: Expr
nothing :: Expr
nothing = Expr
nothingInt
nothingInt :: Expr
nothingInt :: Expr
nothingInt = forall a. (Typeable a, Show a) => a -> Expr
val (forall a. Maybe a
Nothing :: Maybe Int)
nothingBool :: Expr
nothingBool :: Expr
nothingBool = forall a. (Typeable a, Show a) => a -> Expr
val (forall a. Maybe a
Nothing :: Maybe Bool)
justInt :: Expr
justInt :: Expr
justInt = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"Just" (forall a. a -> Maybe a
Just :: Int -> Maybe Int)
justBool :: Expr
justBool :: Expr
justBool = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"Just" (forall a. a -> Maybe a
Just :: Bool -> Maybe Bool)
just :: Expr -> Expr
just :: Expr -> Expr
just Expr
ex = forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ Expr
justInt
, Expr
justBool
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"just: unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
(-|-) :: Expr -> Expr -> Expr
-|- :: Expr -> Expr -> Expr
(-|-) = Expr -> Expr -> Expr
pair
pair :: Expr -> Expr -> Expr
pair :: Expr -> Expr -> Expr
pair Expr
x Expr
y = Expr
comma Expr -> Expr -> Expr
:$ Expr
x Expr -> Expr -> Expr
:$ Expr
y
where
comma :: Expr
comma = case (forall a. Show a => a -> [Char]
show forall a b. (a -> b) -> a -> b
$ Expr -> TypeRep
typ Expr
x, forall a. Show a => a -> [Char]
show forall a b. (a -> b) -> a -> b
$ Expr -> TypeRep
typ Expr
y) of
([Char]
"Int", [Char]
"Int") -> forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"," ((,) :: Pair Int Int)
([Char]
"Int", [Char]
"Bool") -> forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"," ((,) :: Pair Int Bool)
([Char]
"Bool",[Char]
"Int") -> forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"," ((,) :: Pair Bool Int)
([Char]
"Bool",[Char]
"Bool") -> forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"," ((,) :: Pair Bool Bool)
([Char]
t,[Char]
t') -> forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"(-:-): unhandled types " forall a. [a] -> [a] -> [a]
++ [Char]
t forall a. [a] -> [a] -> [a]
++ [Char]
" " forall a. [a] -> [a] -> [a]
++ [Char]
t'
type Pair a b = a -> b -> (a,b)
comma :: Expr
comma :: Expr
comma = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"," ((,) :: Pair Int Int)
triple :: Expr -> Expr -> Expr -> Expr
triple :: Expr -> Expr -> Expr -> Expr
triple Expr
e1 Expr
e2 Expr
e3 = Expr
ccE Expr -> Expr -> Expr
:$ Expr
e1 Expr -> Expr -> Expr
:$ Expr
e2 Expr -> Expr -> Expr
:$ Expr
e3
where
ccE :: Expr
ccE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
",," ((,,) :: Int -> Int -> Int -> (Int,Int,Int))
quadruple :: Expr -> Expr -> Expr -> Expr -> Expr
quadruple :: Expr -> Expr -> Expr -> Expr -> Expr
quadruple Expr
e1 Expr
e2 Expr
e3 Expr
e4 = Expr
cccE Expr -> Expr -> Expr
:$ Expr
e1 Expr -> Expr -> Expr
:$ Expr
e2 Expr -> Expr -> Expr
:$ Expr
e3 Expr -> Expr -> Expr
:$ Expr
e4
where
cccE :: Expr
cccE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
",,," ((,,,) :: Int -> Int -> Int -> Int -> (Int,Int,Int,Int))
quintuple :: Expr -> Expr -> Expr -> Expr -> Expr -> Expr
quintuple :: Expr -> Expr -> Expr -> Expr -> Expr -> Expr
quintuple Expr
e1 Expr
e2 Expr
e3 Expr
e4 Expr
e5 = Expr
ccccE Expr -> Expr -> Expr
:$ Expr
e1 Expr -> Expr -> Expr
:$ Expr
e2 Expr -> Expr -> Expr
:$ Expr
e3 Expr -> Expr -> Expr
:$ Expr
e4 Expr -> Expr -> Expr
:$ Expr
e5
where
ccccE :: Expr
ccccE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
",,,," ((,,,,) :: Int -> Int -> Int -> Int -> Int -> (Int,Int,Int,Int,Int))
sixtuple :: Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr
sixtuple :: Expr -> Expr -> Expr -> Expr -> Expr -> Expr -> Expr
sixtuple Expr
e1 Expr
e2 Expr
e3 Expr
e4 Expr
e5 Expr
e6 = Expr
cccccE Expr -> Expr -> Expr
:$ Expr
e1 Expr -> Expr -> Expr
:$ Expr
e2 Expr -> Expr -> Expr
:$ Expr
e3 Expr -> Expr -> Expr
:$ Expr
e4 Expr -> Expr -> Expr
:$ Expr
e5 Expr -> Expr -> Expr
:$ Expr
e6
where
cccccE :: Expr
cccccE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
",,,,," ((,,,,,) :: Int -> Int -> Int -> Int -> Int -> Int -> (Int,Int,Int,Int,Int,Int))
bs_ :: Expr
bs_ :: Expr
bs_ = forall a. Typeable a => a -> Expr
hole [Bool
bool]
pps :: Expr
pps :: Expr
pps = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"ps" [Bool
bool]
qqs :: Expr
qqs :: Expr
qqs = forall a. Typeable a => [Char] -> a -> Expr
var [Char]
"qs" [Bool
bool]
and' :: Expr -> Expr
and' :: Expr -> Expr
and' Expr
e = Expr
andE Expr -> Expr -> Expr
:$ Expr
e
where
andE :: Expr
andE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"and" (forall (t :: * -> *). Foldable t => t Bool -> Bool
and :: [Bool] -> Bool)
or' :: Expr -> Expr
or' :: Expr -> Expr
or' Expr
e = Expr
orE Expr -> Expr -> Expr
:$ Expr
e
where
orE :: Expr
orE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"or" (forall (t :: * -> *). Foldable t => t Bool -> Bool
or :: [Bool] -> Bool)
sum' :: Expr -> Expr
sum' :: Expr -> Expr
sum' Expr
e = Expr
sumE Expr -> Expr -> Expr
:$ Expr
e
where
sumE :: Expr
sumE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"sum" (forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
sum :: [Int] -> Int)
product' :: Expr -> Expr
product' :: Expr -> Expr
product' Expr
e = Expr
productE Expr -> Expr -> Expr
:$ Expr
e
where
productE :: Expr
productE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"product" (forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
product :: [Int] -> Int)
headOr :: a -> [a] -> a
headOr :: forall a. a -> [a] -> a
headOr a
x [] = a
x
headOr a
_ (a
x:[a]
_) = a
x
(-%-) :: Expr -> Expr -> Expr
Expr
en -%- :: Expr -> Expr -> Expr
-%- Expr
ed = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"%" (forall a. Integral a => a -> a -> Ratio a
(%) :: Integer -> Integer -> Rational) Expr -> Expr -> Expr
:$ Expr
en Expr -> Expr -> Expr
:$ Expr
ed
compose :: Expr
compose :: Expr
compose = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"." (forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) :: Compose Int)
(-.-) :: Expr -> Expr -> Expr
Expr
ex -.- :: Expr -> Expr -> Expr
-.- Expr
ey = (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"." (forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) :: Compose ())
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"." (forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) :: Compose Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"." (forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) :: Compose Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"." (forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) :: Compose Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"." (forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) :: Compose [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"." (forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) :: Compose [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"." (forall b c a. (b -> c) -> (a -> b) -> a -> c
(.) :: Compose [Char])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"(-.-): unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
type Compose a = (a -> a) -> (a -> a) -> (a -> a)
mapE :: Expr
mapE :: Expr
mapE = forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"map" (forall a b. (a -> b) -> [a] -> [b]
map :: Map Int)
map' :: Expr -> Expr -> Expr
map' :: Expr -> Expr -> Expr
map' Expr
ef Expr
exs = (Expr -> Expr -> Expr
:$ Expr
exs) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ef)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"map" (forall a b. (a -> b) -> [a] -> [b]
map :: Map ())
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"map" (forall a b. (a -> b) -> [a] -> [b]
map :: Map Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"map" (forall a b. (a -> b) -> [a] -> [b]
map :: Map Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"map" (forall a b. (a -> b) -> [a] -> [b]
map :: Map Char)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"map" (forall a b. (a -> b) -> [a] -> [b]
map :: Map [Int])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"map" (forall a b. (a -> b) -> [a] -> [b]
map :: Map [Bool])
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"map" (forall a b. (a -> b) -> [a] -> [b]
map :: Map [Char])
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"map': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ef)
type Map a = (a -> a) -> [a] -> [a]
enumFrom' :: Expr -> Expr
enumFrom' :: Expr -> Expr
enumFrom' Expr
ex = forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"enumFrom" (forall a. Enum a => a -> [a]
enumFrom :: EnumFrom Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"enumFrom" (forall a. Enum a => a -> [a]
enumFrom :: EnumFrom Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"enumFrom" (forall a. Enum a => a -> [a]
enumFrom :: EnumFrom Char)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"enumFrom': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
type EnumFrom a = (a -> [a])
(-..) :: Expr -> Expr
-.. :: Expr -> Expr
(-..) Expr
ex = forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
".." (forall a. Enum a => a -> [a]
enumFrom :: EnumFrom Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
".." (forall a. Enum a => a -> [a]
enumFrom :: EnumFrom Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
".." (forall a. Enum a => a -> [a]
enumFrom :: EnumFrom Char)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"(-..): unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
enumFromTo' :: Expr -> Expr -> Expr
enumFromTo' :: Expr -> Expr -> Expr
enumFromTo' Expr
ex Expr
ey = (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"enumFromTo" (forall a. Enum a => a -> a -> [a]
enumFromTo :: EnumFromTo Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"enumFromTo" (forall a. Enum a => a -> a -> [a]
enumFromTo :: EnumFromTo Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"enumFromTo" (forall a. Enum a => a -> a -> [a]
enumFromTo :: EnumFromTo Char)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"enumFromTo': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
type EnumFromTo a = (a -> a -> [a])
(-..-) :: Expr -> Expr -> Expr
Expr
ex -..- :: Expr -> Expr -> Expr
-..- Expr
ey = (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
".." (forall a. Enum a => a -> a -> [a]
enumFromTo :: EnumFromTo Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
".." (forall a. Enum a => a -> a -> [a]
enumFromTo :: EnumFromTo Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
".." (forall a. Enum a => a -> a -> [a]
enumFromTo :: EnumFromTo Char)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"-..-: unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
enumFromThen' :: Expr -> Expr -> Expr
enumFromThen' :: Expr -> Expr -> Expr
enumFromThen' Expr
ex Expr
ey = (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"enumFromThen" (forall a. Enum a => a -> a -> [a]
enumFromThen :: EnumFromThen Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"enumFromThen" (forall a. Enum a => a -> a -> [a]
enumFromThen :: EnumFromThen Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"enumFromThen" (forall a. Enum a => a -> a -> [a]
enumFromThen :: EnumFromThen Char)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"enumFromThen': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
type EnumFromThen a = (a -> a -> [a])
(-...) :: Expr -> Expr -> Expr
Expr
ex -... :: Expr -> Expr -> Expr
-... Expr
ey = (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
",.." (forall a. Enum a => a -> a -> [a]
enumFromThen :: EnumFromThen Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
",.." (forall a. Enum a => a -> a -> [a]
enumFromThen :: EnumFromThen Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
",.." (forall a. Enum a => a -> a -> [a]
enumFromThen :: EnumFromThen Char)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"-..-: unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
enumFromThenTo' :: Expr -> Expr -> Expr -> Expr
enumFromThenTo' :: Expr -> Expr -> Expr -> Expr
enumFromThenTo' Expr
ex Expr
ey Expr
ez = (Expr -> Expr -> Expr
:$ Expr
ez) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"enumFromThenTo" (forall a. Enum a => a -> a -> a -> [a]
enumFromThenTo :: EnumFromThenTo Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"enumFromThenTo" (forall a. Enum a => a -> a -> a -> [a]
enumFromThenTo :: EnumFromThenTo Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
"enumFromThenTo" (forall a. Enum a => a -> a -> a -> [a]
enumFromThenTo :: EnumFromThenTo Char)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"enumFromThenTo': unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)
type EnumFromThenTo a = (a -> a -> a -> [a])
(-...-) :: Expr -> Expr -> Expr -> Expr
(Expr
ex -...- :: Expr -> Expr -> Expr -> Expr
-...- Expr
ey) Expr
ez = (Expr -> Expr -> Expr
:$ Expr
ez) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Expr -> Expr -> Expr
:$ Expr
ey) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> [a] -> a
headOr forall {a}. a
err forall a b. (a -> b) -> a -> b
$ forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe (Expr -> Expr -> Maybe Expr
$$ Expr
ex)
[ forall a. Typeable a => [Char] -> a -> Expr
value [Char]
",.." (forall a. Enum a => a -> a -> a -> [a]
enumFromThenTo :: EnumFromThenTo Int)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
",.." (forall a. Enum a => a -> a -> a -> [a]
enumFromThenTo :: EnumFromThenTo Bool)
, forall a. Typeable a => [Char] -> a -> Expr
value [Char]
",.." (forall a. Enum a => a -> a -> a -> [a]
enumFromThenTo :: EnumFromThenTo Char)
]
where
err :: a
err = forall a. HasCallStack => [Char] -> a
error forall a b. (a -> b) -> a -> b
$ [Char]
"-..-: unhandled type " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> [Char]
show (Expr -> TypeRep
typ Expr
ex)