Skip to content

Commit f89e9f3

Browse files
committed
Formatting
1 parent b038c1c commit f89e9f3

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

test/ArithmeticTests.hs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1-
{-# LANGUAGE DeriveFunctor #-}
21
{-# LANGUAGE FlexibleInstances #-}
3-
{-# LANGUAGE PartialTypeSignatures #-}
4-
{-# LANGUAGE LambdaCase #-}
52
{-# LANGUAGE MultiParamTypeClasses #-}
3+
{-# LANGUAGE PartialTypeSignatures #-}
64
{-# LANGUAGE ScopedTypeVariables #-}
75

86
module Main where
97

108
import Common
119
import Control.Comonad.Cofree (Cofree ((:<)))
1210
import Data.Bifunctor (second)
11+
import Data.Ratio
1312
import PrettyPrint
1413
import qualified System.IO.Strict as Strict
1514
import Telomare
16-
import Telomare.Eval (compileUnitTest, EvalError (CompileConversionError))
17-
import Telomare.RunTime (simpleEval)
15+
import Telomare.Eval (EvalError (CompileConversionError), compileUnitTest)
16+
import Telomare.Parser (AnnotatedUPT, TelomareParser, parseLongExpr,
17+
parsePrelude)
1818
import Telomare.Resolver (process)
19-
import Telomare.Parser (parseLongExpr, TelomareParser, parsePrelude, AnnotatedUPT)
19+
import Telomare.RunTime (simpleEval)
2020
import Test.Tasty
2121
import Test.Tasty.HUnit
2222
import Test.Tasty.QuickCheck as QC
23-
import Text.Megaparsec (runParser, errorBundlePretty, eof)
24-
import Data.Ratio
23+
import Text.Megaparsec (eof, errorBundlePretty, runParser)
2524

2625
main :: IO ()
2726
main = defaultMain tests
@@ -49,7 +48,7 @@ loadPreludeBindings :: IO [(String, UnprocessedParsedTerm)]
4948
loadPreludeBindings = do
5049
preludeResult <- Strict.readFile "Prelude.tel"
5150
case parsePrelude preludeResult of
52-
Left _ -> pure []
51+
Left _ -> pure []
5352
Right bs -> pure $ fmap (second forget) bs
5453

5554
evalExprString :: String -> IO (Either String String)
@@ -59,11 +58,11 @@ evalExprString input = do
5958
case parseResult of
6059
Left err -> pure $ Left (errorBundlePretty err)
6160
Right exprBindings -> do
62-
let allBindingsUPT = preludeBindings ++ exprBindings
61+
let allBindingsUPT = preludeBindings <> exprBindings
6362
allBindings :: [(String, Cofree UnprocessedParsedTermF LocTag)]
6463
allBindings = fmap (second (tag DummyLoc)) allBindingsUPT
6564
uptMaybe = lookup "_tmp_" allBindings
66-
termMaybe = fmap (DummyLoc :<) . fmap (LetUPF allBindings) $ uptMaybe
65+
termMaybe = fmap ((DummyLoc :<) . LetUPF allBindings) uptMaybe
6766
compiled = compileUnitTest =<< maybeToRight (termMaybe >>= rightToMaybe . process)
6867
case compiled of
6968
Left err -> pure $ Left (show err)
@@ -75,7 +74,7 @@ assertExpr :: String -> String -> Assertion
7574
assertExpr input expected = do
7675
res <- evalExprString input
7776
case res of
78-
Left err -> assertFailure $ "Evaluation failed: " <> err
77+
Left err -> assertFailure $ "Evaluation failed: " <> err
7978
Right val -> val @?= expected
8079

8180
rationalToString :: Ratio Integer -> String
@@ -121,9 +120,9 @@ unitTestsRatArithmetic = testGroup "Unit tests on natural arithmetic expresions"
121120
---------------------
122121

123122
qcPropsNatArithmetic = testGroup "Property tests on natural arithmetic expressions (QuickCheck)"
124-
[
123+
[
125124
]
126125

127126
qcPropsRatArithmetic = testGroup "Property tests on rational arithmetic expressions (QuickCheck)"
128-
[
127+
[
129128
]

0 commit comments

Comments
 (0)