module Test.Translate(testTypeCheck, testQuickCheck) where
import Control.Monad
import Control.Monad.IO.Class
import Data.List.Extra
import System.IO.Extra
import Data.Maybe
import System.Process
import System.Exit
import System.FilePath
import Config.Type
import HSE.All
import Test.Util
runMains :: FilePath -> FilePath -> [String] -> Test ()
runMains :: FilePath -> FilePath -> [FilePath] -> Test ()
runMains datadir :: FilePath
datadir tmpdir :: FilePath
tmpdir xs :: [FilePath]
xs = do
ExitCode
res <- IO ExitCode -> Test ExitCode
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ExitCode -> Test ExitCode) -> IO ExitCode -> Test ExitCode
forall a b. (a -> b) -> a -> b
$ (if FilePath
tmpdir FilePath -> FilePath -> Bool
forall a. Eq a => a -> a -> Bool
== "" then (FilePath -> IO ExitCode) -> IO ExitCode
forall a. (FilePath -> IO a) -> IO a
withTempDir else ((FilePath -> IO ExitCode) -> FilePath -> IO ExitCode
forall a b. (a -> b) -> a -> b
$ FilePath
tmpdir)) ((FilePath -> IO ExitCode) -> IO ExitCode)
-> (FilePath -> IO ExitCode) -> IO ExitCode
forall a b. (a -> b) -> a -> b
$ \dir :: FilePath
dir -> do
[FilePath]
ms <- [(Integer, FilePath)]
-> ((Integer, FilePath) -> IO FilePath) -> IO [FilePath]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
forM ([Integer] -> [FilePath] -> [(Integer, FilePath)]
forall a b. [a] -> [b] -> [(a, b)]
zip [1..] [FilePath]
xs) (((Integer, FilePath) -> IO FilePath) -> IO [FilePath])
-> ((Integer, FilePath) -> IO FilePath) -> IO [FilePath]
forall a b. (a -> b) -> a -> b
$ \(i :: Integer
i,x :: FilePath
x) -> do
let m :: FilePath
m = "I" FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ Integer -> FilePath
forall a. Show a => a -> FilePath
show Integer
i
FilePath -> FilePath -> IO ()
writeFile (FilePath
dir FilePath -> FilePath -> FilePath
</> FilePath
m FilePath -> FilePath -> FilePath
<.> "hs") (FilePath -> IO ()) -> FilePath -> IO ()
forall a b. (a -> b) -> a -> b
$ FilePath -> FilePath -> FilePath -> FilePath
forall a. (Partial, Eq a) => [a] -> [a] -> [a] -> [a]
replace "module Main" ("module " FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath
m) FilePath
x
FilePath -> IO FilePath
forall (m :: * -> *) a. Monad m => a -> m a
return FilePath
m
FilePath -> FilePath -> IO ()
writeFile (FilePath
dir FilePath -> FilePath -> FilePath
</> "Main.hs") (FilePath -> IO ()) -> FilePath -> IO ()
forall a b. (a -> b) -> a -> b
$ [FilePath] -> FilePath
unlines ([FilePath] -> FilePath) -> [FilePath] -> FilePath
forall a b. (a -> b) -> a -> b
$
["import qualified " FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath
m | FilePath
m <- [FilePath]
ms] [FilePath] -> [FilePath] -> [FilePath]
forall a. [a] -> [a] -> [a]
++
["main = do"] [FilePath] -> [FilePath] -> [FilePath]
forall a. [a] -> [a] -> [a]
++
[" " FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath
m FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ ".main" | FilePath
m <- [FilePath]
ms]
FilePath -> IO ExitCode
system (FilePath -> IO ExitCode) -> FilePath -> IO ExitCode
forall a b. (a -> b) -> a -> b
$ "runhaskell -i" FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath
dir FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ " -i" FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath
datadir FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ " Main"
Int -> Test () -> Test ()
forall (m :: * -> *) a. Applicative m => Int -> m a -> m ()
replicateM_ ([FilePath] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [FilePath]
xs) (Test () -> Test ()) -> Test () -> Test ()
forall a b. (a -> b) -> a -> b
$ Bool -> Test ()
tested (Bool -> Test ()) -> Bool -> Test ()
forall a b. (a -> b) -> a -> b
$ ExitCode
res ExitCode -> ExitCode -> Bool
forall a. Eq a => a -> a -> Bool
== ExitCode
ExitSuccess
testTypeCheck :: FilePath -> FilePath -> [[Setting]] -> Test ()
testTypeCheck :: FilePath -> FilePath -> [[Setting]] -> Test ()
testTypeCheck = ([HintRule] -> [FilePath])
-> FilePath -> FilePath -> [[Setting]] -> Test ()
wrap [HintRule] -> [FilePath]
toTypeCheck
testQuickCheck :: FilePath -> FilePath -> [[Setting]] -> Test ()
testQuickCheck :: FilePath -> FilePath -> [[Setting]] -> Test ()
testQuickCheck = ([HintRule] -> [FilePath])
-> FilePath -> FilePath -> [[Setting]] -> Test ()
wrap [HintRule] -> [FilePath]
toQuickCheck
wrap :: ([HintRule] -> [String]) -> FilePath -> FilePath -> [[Setting]] -> Test ()
wrap :: ([HintRule] -> [FilePath])
-> FilePath -> FilePath -> [[Setting]] -> Test ()
wrap f :: [HintRule] -> [FilePath]
f datadir :: FilePath
datadir tmpdir :: FilePath
tmpdir hints :: [[Setting]]
hints = FilePath -> FilePath -> [FilePath] -> Test ()
runMains FilePath
datadir FilePath
tmpdir [[FilePath] -> FilePath
unlines ([FilePath] -> FilePath) -> [FilePath] -> FilePath
forall a b. (a -> b) -> a -> b
$ [HintRule] -> [FilePath]
body [HintRule
x | SettingMatchExp x :: HintRule
x <- [Setting]
xs] | [Setting]
xs <- [[Setting]]
hints]
where
body :: [HintRule] -> [FilePath]
body xs :: [HintRule]
xs =
["{-# LANGUAGE NoMonomorphismRestriction, ExtendedDefaultRules, ScopedTypeVariables, DeriveDataTypeable #-}"
,"{-# LANGUAGE FlexibleInstances, UndecidableInstances, OverlappingInstances #-}"
,"module Main(main) where"] [FilePath] -> [FilePath] -> [FilePath]
forall a. [a] -> [a] -> [a]
++
[[FilePath]] -> [FilePath]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [(ImportDecl S -> FilePath) -> [ImportDecl S] -> [FilePath]
forall a b. (a -> b) -> [a] -> [b]
map (ImportDecl S -> FilePath
forall a. Pretty a => a -> FilePath
prettyPrint (ImportDecl S -> FilePath)
-> (ImportDecl S -> ImportDecl S) -> ImportDecl S -> FilePath
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ImportDecl S -> ImportDecl S
forall l. ImportDecl l -> ImportDecl l
hackImport) ([ImportDecl S] -> [FilePath]) -> [ImportDecl S] -> [FilePath]
forall a b. (a -> b) -> a -> b
$ Scope -> [ImportDecl S]
scopeImports (Scope -> [ImportDecl S]) -> Scope -> [ImportDecl S]
forall a b. (a -> b) -> a -> b
$ HintRule -> Scope
hintRuleScope HintRule
x | HintRule
x <- Int -> [HintRule] -> [HintRule]
forall a. Int -> [a] -> [a]
take 1 [HintRule]
xs] [FilePath] -> [FilePath] -> [FilePath]
forall a. [a] -> [a] -> [a]
++
[HintRule] -> [FilePath]
f [HintRule]
xs
hackImport :: ImportDecl l -> ImportDecl l
hackImport i :: ImportDecl l
i@ImportDecl{importAs :: forall l. ImportDecl l -> Maybe (ModuleName l)
importAs=Just a :: ModuleName l
a,importModule :: forall l. ImportDecl l -> ModuleName l
importModule=ModuleName l
b}
| ModuleName l -> FilePath
forall a. Pretty a => a -> FilePath
prettyPrint ModuleName l
b FilePath -> [FilePath] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` FilePath -> [FilePath]
words "Maybe List Monad IO Char" = ImportDecl l
i{importAs :: Maybe (ModuleName l)
importAs=ModuleName l -> Maybe (ModuleName l)
forall a. a -> Maybe a
Just ModuleName l
b,importModule :: ModuleName l
importModule=ModuleName l
a}
hackImport i :: ImportDecl l
i = ImportDecl l
i
toTypeCheck :: [HintRule] -> [String]
toTypeCheck :: [HintRule] -> [FilePath]
toTypeCheck hints :: [HintRule]
hints =
["import HLint_TypeCheck hiding(main)"
,"main = return ()"] [FilePath] -> [FilePath] -> [FilePath]
forall a. [a] -> [a] -> [a]
++
["{-# LINE " FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ Int -> FilePath
forall a. Show a => a -> FilePath
show (S -> Int
forall si. SrcInfo si => si -> Int
startLine (S -> Int) -> S -> Int
forall a b. (a -> b) -> a -> b
$ Exp S -> S
forall (ast :: * -> *) l. Annotated ast => ast l -> l
ann Exp S
rhs) FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ " " FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ FilePath -> FilePath
forall a. Show a => a -> FilePath
show (S -> FilePath
forall si. SrcInfo si => si -> FilePath
fileName (S -> FilePath) -> S -> FilePath
forall a b. (a -> b) -> a -> b
$ Exp S -> S
forall (ast :: * -> *) l. Annotated ast => ast l -> l
ann Exp S
rhs) FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ " #-}\n" FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++
Decl S -> FilePath
forall a. Pretty a => a -> FilePath
prettyPrint (S -> Pat S -> Rhs S -> Maybe (Binds S) -> Decl S
forall l. l -> Pat l -> Rhs l -> Maybe (Binds l) -> Decl l
PatBind S
an (FilePath -> Pat S
forall a. Named a => FilePath -> a
toNamed (FilePath -> Pat S) -> FilePath -> Pat S
forall a b. (a -> b) -> a -> b
$ "test" FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ Integer -> FilePath
forall a. Show a => a -> FilePath
show Integer
i) Rhs S
bod Maybe (Binds S)
forall a. Maybe a
Nothing)
| (i :: Integer
i, HintRule _ _ _ lhs :: Exp S
lhs rhs :: Exp S
rhs side :: Maybe (Exp S)
side _notes :: [Note]
_notes _ghcScope :: HsExtendInstances Scope'
_ghcScope _ghcLhs :: HsExtendInstances (LHsExpr GhcPs)
_ghcLhs _ghcRhs :: HsExtendInstances (LHsExpr GhcPs)
_ghcRhs _ghcSide :: Maybe (HsExtendInstances (LHsExpr GhcPs))
_ghcSide) <- [Integer] -> [HintRule] -> [(Integer, HintRule)]
forall a b. [a] -> [b] -> [(a, b)]
zip [1..] [HintRule]
hints, "noTypeCheck" FilePath -> [FilePath] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` [Exp S] -> [FilePath]
forall a. FreeVars a => a -> [FilePath]
vars (Maybe (Exp S) -> [Exp S]
forall a. Maybe a -> [a]
maybeToList Maybe (Exp S)
side)
, let vs :: [Pat S]
vs = (FilePath -> Pat S) -> [FilePath] -> [Pat S]
forall a b. (a -> b) -> [a] -> [b]
map FilePath -> Pat S
forall a. Named a => FilePath -> a
toNamed ([FilePath] -> [Pat S]) -> [FilePath] -> [Pat S]
forall a b. (a -> b) -> a -> b
$ [FilePath] -> [FilePath]
forall a. Ord a => [a] -> [a]
nubOrd ([FilePath] -> [FilePath]) -> [FilePath] -> [FilePath]
forall a b. (a -> b) -> a -> b
$ (FilePath -> Bool) -> [FilePath] -> [FilePath]
forall a. (a -> Bool) -> [a] -> [a]
filter FilePath -> Bool
isUnifyVar ([FilePath] -> [FilePath]) -> [FilePath] -> [FilePath]
forall a b. (a -> b) -> a -> b
$ Exp S -> [FilePath]
forall a. FreeVars a => a -> [FilePath]
vars Exp S
lhs [FilePath] -> [FilePath] -> [FilePath]
forall a. [a] -> [a] -> [a]
++ Exp S -> [FilePath]
forall a. FreeVars a => a -> [FilePath]
vars Exp S
rhs
, let inner :: Exp S
inner = S -> Exp S -> QOp S -> Exp S -> Exp S
forall l. l -> Exp l -> QOp l -> Exp l -> Exp l
InfixApp S
an (S -> Exp S -> Exp S
forall l. l -> Exp l -> Exp l
Paren S
an Exp S
lhs) (FilePath -> QOp S
forall a. Named a => FilePath -> a
toNamed "==>") (S -> Exp S -> Exp S
forall l. l -> Exp l -> Exp l
Paren S
an Exp S
rhs)
, let bod :: Rhs S
bod = S -> Exp S -> Rhs S
forall l. l -> Exp l -> Rhs l
UnGuardedRhs S
an (Exp S -> Rhs S) -> Exp S -> Rhs S
forall a b. (a -> b) -> a -> b
$ if [Pat S] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [Pat S]
vs then Exp S
inner else S -> [Pat S] -> Exp S -> Exp S
forall l. l -> [Pat l] -> Exp l -> Exp l
Lambda S
an [Pat S]
vs Exp S
inner]
toQuickCheck :: [HintRule] -> [String]
toQuickCheck :: [HintRule] -> [FilePath]
toQuickCheck hints :: [HintRule]
hints =
["import HLint_QuickCheck hiding(main)"
,"default(Maybe Bool,Int,Dbl)"
,Decl S -> FilePath
forall a. Pretty a => a -> FilePath
prettyPrint (Decl S -> FilePath) -> Decl S -> FilePath
forall a b. (a -> b) -> a -> b
$ S -> Pat S -> Rhs S -> Maybe (Binds S) -> Decl S
forall l. l -> Pat l -> Rhs l -> Maybe (Binds l) -> Decl l
PatBind S
an (FilePath -> Pat S
forall a. Named a => FilePath -> a
toNamed "main") (S -> Exp S -> Rhs S
forall l. l -> Exp l -> Rhs l
UnGuardedRhs S
an (Exp S -> Rhs S) -> Exp S -> Rhs S
forall a b. (a -> b) -> a -> b
$ FilePath -> Exp S
forall a. Named a => FilePath -> a
toNamed "withMain" Exp S -> Exp S -> Exp S
$$ S -> [Stmt S] -> Exp S
forall l. l -> [Stmt l] -> Exp l
Do S
an [Stmt S]
tests) Maybe (Binds S)
forall a. Maybe a
Nothing]
where
str :: FilePath -> Exp S
str x :: FilePath
x = S -> Literal S -> Exp S
forall l. l -> Literal l -> Exp l
Lit S
an (Literal S -> Exp S) -> Literal S -> Exp S
forall a b. (a -> b) -> a -> b
$ S -> FilePath -> FilePath -> Literal S
forall l. l -> FilePath -> FilePath -> Literal l
String S
an FilePath
x (FilePath -> FilePath
forall a. Show a => a -> FilePath
show FilePath
x)
int :: a -> Exp S
int x :: a
x = S -> Literal S -> Exp S
forall l. l -> Literal l -> Exp l
Lit S
an (Literal S -> Exp S) -> Literal S -> Exp S
forall a b. (a -> b) -> a -> b
$ S -> Integer -> FilePath -> Literal S
forall l. l -> Integer -> FilePath -> Literal l
Int S
an (a -> Integer
forall a. Integral a => a -> Integer
toInteger a
x) (a -> FilePath
forall a. Show a => a -> FilePath
show a
x)
app :: Exp S -> Exp S -> Exp S
app = S -> Exp S -> Exp S -> Exp S
forall l. l -> Exp l -> Exp l -> Exp l
App S
an
a :: Exp S
a $$ :: Exp S -> Exp S -> Exp S
$$ b :: Exp S
b = S -> Exp S -> QOp S -> Exp S -> Exp S
forall l. l -> Exp l -> QOp l -> Exp l -> Exp l
InfixApp S
an Exp S
a (FilePath -> QOp S
forall a. Named a => FilePath -> a
toNamed "$") Exp S
b
tests :: [Stmt S]
tests =
[ S -> Exp S -> Stmt S
forall l. l -> Exp l -> Stmt l
Qualifier S
an (Exp S -> Stmt S) -> Exp S -> Stmt S
forall a b. (a -> b) -> a -> b
$
S -> Binds S -> Exp S -> Exp S
forall l. l -> Binds l -> Exp l -> Exp l
Let S
an (S -> [Decl S] -> Binds S
forall l. l -> [Decl l] -> Binds l
BDecls S
an [S -> Pat S -> Rhs S -> Maybe (Binds S) -> Decl S
forall l. l -> Pat l -> Rhs l -> Maybe (Binds l) -> Decl l
PatBind S
an (FilePath -> Pat S
forall a. Named a => FilePath -> a
toNamed "t") (S -> Exp S -> Rhs S
forall l. l -> Exp l -> Rhs l
UnGuardedRhs S
an Exp S
bod) Maybe (Binds S)
forall a. Maybe a
Nothing]) (Exp S -> Exp S) -> Exp S -> Exp S
forall a b. (a -> b) -> a -> b
$
(FilePath -> Exp S
forall a. Named a => FilePath -> a
toNamed "test" Exp S -> Exp S -> Exp S
`app` FilePath -> Exp S
str (S -> FilePath
forall si. SrcInfo si => si -> FilePath
fileName (S -> FilePath) -> S -> FilePath
forall a b. (a -> b) -> a -> b
$ Exp S -> S
forall (ast :: * -> *) l. Annotated ast => ast l -> l
ann Exp S
rhs) Exp S -> Exp S -> Exp S
`app` Int -> Exp S
forall a. (Integral a, Show a) => a -> Exp S
int (S -> Int
forall si. SrcInfo si => si -> Int
startLine (S -> Int) -> S -> Int
forall a b. (a -> b) -> a -> b
$ Exp S -> S
forall (ast :: * -> *) l. Annotated ast => ast l -> l
ann Exp S
rhs) Exp S -> Exp S -> Exp S
`app`
FilePath -> Exp S
str (Exp S -> FilePath
forall a. Pretty a => a -> FilePath
prettyPrint Exp S
lhs FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ " ==> " FilePath -> FilePath -> FilePath
forall a. [a] -> [a] -> [a]
++ Exp S -> FilePath
forall a. Pretty a => a -> FilePath
prettyPrint Exp S
rhs)) Exp S -> Exp S -> Exp S
`app` FilePath -> Exp S
forall a. Named a => FilePath -> a
toNamed "t"
| (i :: Integer
i, HintRule _ _ _ lhs :: Exp S
lhs rhs :: Exp S
rhs side :: Maybe (Exp S)
side note :: [Note]
note _ghcScope :: HsExtendInstances Scope'
_ghcScope _ghcLhs :: HsExtendInstances (LHsExpr GhcPs)
_ghcLhs _ghcRhs :: HsExtendInstances (LHsExpr GhcPs)
_ghcRhs _ghcSide :: Maybe (HsExtendInstances (LHsExpr GhcPs))
_ghcSide) <- [Integer] -> [HintRule] -> [(Integer, HintRule)]
forall a b. [a] -> [b] -> [(a, b)]
zip [1..] [HintRule]
hints, "noQuickCheck" FilePath -> [FilePath] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` [Exp S] -> [FilePath]
forall a. FreeVars a => a -> [FilePath]
vars (Maybe (Exp S) -> [Exp S]
forall a. Maybe a -> [a]
maybeToList Maybe (Exp S)
side)
, let vs :: [Pat S]
vs = (FilePath -> Pat S) -> [FilePath] -> [Pat S]
forall a b. (a -> b) -> [a] -> [b]
map (Maybe (Exp S) -> FilePath -> Pat S
forall l1. Data l1 => Maybe (Exp l1) -> FilePath -> Pat S
restrict Maybe (Exp S)
side) ([FilePath] -> [Pat S]) -> [FilePath] -> [Pat S]
forall a b. (a -> b) -> a -> b
$ [FilePath] -> [FilePath]
forall a. Ord a => [a] -> [a]
nubOrd ([FilePath] -> [FilePath]) -> [FilePath] -> [FilePath]
forall a b. (a -> b) -> a -> b
$ (FilePath -> Bool) -> [FilePath] -> [FilePath]
forall a. (a -> Bool) -> [a] -> [a]
filter FilePath -> Bool
isUnifyVar ([FilePath] -> [FilePath]) -> [FilePath] -> [FilePath]
forall a b. (a -> b) -> a -> b
$ Exp S -> [FilePath]
forall a. FreeVars a => a -> [FilePath]
vars Exp S
lhs [FilePath] -> [FilePath] -> [FilePath]
forall a. [a] -> [a] -> [a]
++ Exp S -> [FilePath]
forall a. FreeVars a => a -> [FilePath]
vars Exp S
rhs
, let op :: FilePath
op = if (Note -> Bool) -> [Note] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any Note -> Bool
isRemovesError [Note]
note then "?==>" else "==>"
, let inner :: Exp S
inner = S -> Exp S -> QOp S -> Exp S -> Exp S
forall l. l -> Exp l -> QOp l -> Exp l -> Exp l
InfixApp S
an (S -> Exp S -> Exp S
forall l. l -> Exp l -> Exp l
Paren S
an Exp S
lhs) (FilePath -> QOp S
forall a. Named a => FilePath -> a
toNamed FilePath
op) (S -> Exp S -> Exp S
forall l. l -> Exp l -> Exp l
Paren S
an Exp S
rhs)
, let bod :: Exp S
bod = if [Pat S] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [Pat S]
vs then S -> Exp S -> Exp S
forall l. l -> Exp l -> Exp l
Paren S
an Exp S
inner else S -> [Pat S] -> Exp S -> Exp S
forall l. l -> [Pat l] -> Exp l -> Exp l
Lambda S
an [Pat S]
vs Exp S
inner]
restrict :: Maybe (Exp l1) -> FilePath -> Pat S
restrict (Just side :: Exp l1
side) v :: FilePath
v
| (Exp l1 -> Bool) -> [Exp l1] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (Exp l1 -> Exp S -> Bool
forall (a :: * -> *) l1 l2.
(Annotated a, Eq (a ())) =>
a l1 -> a l2 -> Bool
=~= S -> Exp S -> Exp S -> Exp S
forall l. l -> Exp l -> Exp l -> Exp l
App S
an (FilePath -> Exp S
forall a. Named a => FilePath -> a
toNamed "isNegZero") (FilePath -> Exp S
forall a. Named a => FilePath -> a
toNamed FilePath
v)) (Exp l1 -> [Exp l1]
forall on. Uniplate on => on -> [on]
universe Exp l1
side) = S -> QName S -> [Pat S] -> Pat S
forall l. l -> QName l -> [Pat l] -> Pat l
PApp S
an (FilePath -> QName S
forall a. Named a => FilePath -> a
toNamed "NegZero") [FilePath -> Pat S
forall a. Named a => FilePath -> a
toNamed FilePath
v]
| (Exp l1 -> Bool) -> [Exp l1] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (Exp l1 -> Exp S -> Bool
forall (a :: * -> *) l1 l2.
(Annotated a, Eq (a ())) =>
a l1 -> a l2 -> Bool
=~= S -> Exp S -> Exp S -> Exp S
forall l. l -> Exp l -> Exp l -> Exp l
App S
an (FilePath -> Exp S
forall a. Named a => FilePath -> a
toNamed "isNat") (FilePath -> Exp S
forall a. Named a => FilePath -> a
toNamed FilePath
v)) (Exp l1 -> [Exp l1]
forall on. Uniplate on => on -> [on]
universe Exp l1
side) = S -> QName S -> [Pat S] -> Pat S
forall l. l -> QName l -> [Pat l] -> Pat l
PApp S
an (FilePath -> QName S
forall a. Named a => FilePath -> a
toNamed "Nat") [FilePath -> Pat S
forall a. Named a => FilePath -> a
toNamed FilePath
v]
| (Exp l1 -> Bool) -> [Exp l1] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (Exp l1 -> Exp S -> Bool
forall (a :: * -> *) l1 l2.
(Annotated a, Eq (a ())) =>
a l1 -> a l2 -> Bool
=~= S -> Exp S -> Exp S -> Exp S
forall l. l -> Exp l -> Exp l -> Exp l
App S
an (FilePath -> Exp S
forall a. Named a => FilePath -> a
toNamed "isCompare") (FilePath -> Exp S
forall a. Named a => FilePath -> a
toNamed FilePath
v)) (Exp l1 -> [Exp l1]
forall on. Uniplate on => on -> [on]
universe Exp l1
side) = S -> QName S -> [Pat S] -> Pat S
forall l. l -> QName l -> [Pat l] -> Pat l
PApp S
an (FilePath -> QName S
forall a. Named a => FilePath -> a
toNamed "Compare") [FilePath -> Pat S
forall a. Named a => FilePath -> a
toNamed FilePath
v]
restrict _ v :: FilePath
v = FilePath -> Pat S
forall a. Named a => FilePath -> a
toNamed FilePath
v
isRemovesError :: Note -> Bool
isRemovesError :: Note -> Bool
isRemovesError RemovesError{} = Bool
True
isRemovesError _ = Bool
False