Skip to content

Commit 62ac485

Browse files
committed
hlint and formatting
1 parent 16dc48c commit 62ac485

11 files changed

Lines changed: 84 additions & 84 deletions

File tree

app/Evaluare.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import Reflex.Vty
2020
import System.Environment (getArgs)
2121
import qualified System.IO.Strict as Strict
2222
import qualified Telomare as Tel
23-
import Telomare (BasicExprF (..), CompiledExpr, CompiledExprF (..), StuckF (..))
23+
import Telomare (AUPT, AnnotatedUPT (..), BasicExprF (..), CompiledExpr,
24+
CompiledExprF (..), StuckF (..))
2425
import qualified Telomare.Eval as TE
25-
import Telomare (AUPT, AnnotatedUPT (..))
2626
import Telomare.Parser (parseModule)
2727
import Text.Read (readMaybe)
2828

src/PrettyPrint.hs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ module PrettyPrint where
77
import Control.Monad.State (State)
88
import Data.Map (Map)
99
import Telomare (AbortableF (..), BasicExprF (..), CompiledExpr,
10-
CompiledExprF (..), DataType (..), FunctionIndex, LamType (..),
11-
LocTag, ParserTermF (..), PartialTypeF (..), PatternF (..),
12-
StuckExpr, StuckExprF (..), StuckF (..), Term1, Term3 (..),
13-
Term3F (..), UnprocessedParsedTerm (..), PartialType,
10+
CompiledExprF (..), DataType (..), FunctionIndex,
11+
HighTermF (..), LamTermF (..), LamType (..), LocTag,
12+
ParserTermF (..), PartialType, PartialTypeF (..),
13+
PatternF (..), StuckExpr, StuckExprF (..), StuckF (..), Term1,
14+
Term3 (..), Term3F (..), UnprocessedParsedTerm (..),
1415
UnprocessedParsedTermF (..), b2i, convertAbortMessage, forget,
1516
indentWithChildren', indentWithOneChild',
16-
indentWithTwoChildren', locatedNameText, pattern BasicEE, HighTermF (..), BasicExprF (..), LamTermF(..))
17+
indentWithTwoChildren', locatedNameText, pattern BasicEE)
1718

1819
import qualified Control.Comonad.Trans.Cofree as CofreeT (CofreeF (..))
1920
import qualified Control.Monad.State as State

src/Telomare.hs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ module Telomare where
1616

1717
import Control.Applicative (Applicative (liftA2), liftA, liftA3)
1818
import Control.Comonad.Cofree (Cofree ((:<)))
19-
import qualified Control.Comonad.Trans.Cofree as CofreeT (CofreeF (..), ComonadCofree)
19+
import Control.Comonad.Trans.Cofree (CofreeF)
20+
import qualified Control.Comonad.Trans.Cofree as CofreeT (CofreeF (..),
21+
ComonadCofree)
2022
import Control.DeepSeq (NFData (..))
2123
import Control.Lens.Combinators (Plated (..), makePrisms, transform)
2224
import Control.Monad.Except (ExceptT)
@@ -27,8 +29,8 @@ import Data.Bool (bool)
2729
import Data.Char (chr, ord)
2830
import Data.Eq.Deriving (deriveEq1)
2931
import Data.Fix (Fix (..))
30-
import Data.Functor.Classes (Eq1 (..), Eq2 (..), Show1 (..), Show2 (..), eq1,
31-
showsUnary1, Ord1)
32+
import Data.Functor.Classes (Eq1 (..), Eq2 (..), Ord1, Show1 (..), Show2 (..),
33+
eq1, showsUnary1)
3234
import Data.Functor.Foldable (Base, Corecursive (embed),
3335
Recursive (cata, project))
3436
import Data.Functor.Foldable.TH (MakeBaseFunctor (makeBaseFunctor))
@@ -42,7 +44,6 @@ import Data.Void (Void)
4244
import Debug.Trace (trace, traceShow, traceShowId)
4345
import GHC.Generics (Generic, Generic1, Generically1 (..))
4446
import Text.Show.Deriving (deriveShow1)
45-
import Control.Comonad.Trans.Cofree (CofreeF)
4647

4748
{- top level TODO list
4849
- change AbortFrag form to something more convenient
@@ -527,11 +528,11 @@ instance LamBase (ParserTermF l v) where
527528

528529
deriving instance (Eq l, Eq v, Eq a) => Eq (ParserTermF l v a)
529530
instance (Eq l, Eq v) => Eq1 (ParserTermF l v) where
530-
liftEq eq (ParserTermB x) (ParserTermB y) = liftEq eq x y
531-
liftEq eq (ParserTermH x) (ParserTermH y) = liftEq eq x y
532-
liftEq eq (ParserTermL x) (ParserTermL y) = liftEq eq x y
531+
liftEq eq (ParserTermB x) (ParserTermB y) = liftEq eq x y
532+
liftEq eq (ParserTermH x) (ParserTermH y) = liftEq eq x y
533+
liftEq eq (ParserTermL x) (ParserTermL y) = liftEq eq x y
533534
liftEq _ TUnsizedRepeaterF TUnsizedRepeaterF = True
534-
liftEq _ _ _ = False
535+
liftEq _ _ _ = False
535536

536537

537538
-- |Helper function to indent. Usefull for indented Show instances.
@@ -839,7 +840,7 @@ type PartialType = Fix PartialTypeF
839840

840841
toPartialType :: DataType -> PartialType
841842
toPartialType = \case
842-
ZeroType -> embed $ ZeroTypeP
843+
ZeroType -> embed ZeroTypeP
843844
ArrType i o -> embed $ ArrTypeP (toPartialType i) (toPartialType o)
844845
PairType a b -> embed $ PairTypeP (toPartialType a) (toPartialType b)
845846

src/Telomare/Decompiler.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
{-# LANGUAGE LambdaCase #-}
2-
31
module Telomare.Decompiler where
42

53
import Control.Comonad.Cofree (Cofree ((:<)))

src/Telomare/Eval.hs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,21 @@ import qualified Control.Comonad.Trans.Cofree as CofreeT
2828
import Control.Lens (Identity (runIdentity))
2929
import Data.Functor.Foldable (Base, cata, embed, para)
3030
import PrettyPrint
31-
import Telomare (AbortableF (AbortF), AbstractRunTime, BasicExpr,
32-
BasicExprF (..), CompiledExpr, CompiledExprF, EvalError (..),
33-
LocTag (..), LocatedName (..), PartialTypeF (..), Pattern,
34-
ResolverError (..), RunTimeError (..), StuckExpr, StuckF (..),
35-
TelomareLike (..), Term2, Term3, Term3Builder, Term3F (..),
31+
import Telomare (AUPT, AbortableF (AbortF), AbstractRunTime, AnnotatedUPT (..),
32+
BasicExpr, BasicExprF (..), CompiledExpr, CompiledExprF,
33+
EvalError (..), LocTag (..), LocatedName (..),
34+
PartialTypeF (..), Pattern, PatternA, ResolverError (..),
35+
RunTimeError (..), StuckExpr, StuckF (..), TelomareLike (..),
36+
Term2, Term3, Term3Builder, Term3F (..),
3637
UnprocessedParsedTerm (..), UnprocessedParsedTermF (..),
37-
UnsizedRecursionToken (..), pattern AbortEE, appS, b2s, pattern BasicEE,
38-
convertAbort, convertAbortMessage, convertBasic, convertStuck,
39-
deferS, embedB, embedS, pattern EnvB, eval, forget, insertAndGetKey,
40-
pattern LeftB, locStartLineColumn, pattern PairB, pattern AbortFW,
41-
AnnotatedUPT (..), PatternA,
42-
pattern BasicEE, pattern BasicFW, pattern PairP, AUPT,
43-
pattern StuckEE, pattern StuckFW, pattern RightB, s2b,
44-
pattern SetEnvB, pattern StuckEE, tag, pattern ZeroB)
45-
import Telomare.Parser (parseModule, parseOneExprOrTopLevelDefs,
46-
parsePrelude)
38+
UnsizedRecursionToken (..), appS, b2s, convertAbort,
39+
convertAbortMessage, convertBasic, convertStuck, deferS,
40+
embedB, embedS, eval, forget, insertAndGetKey,
41+
locStartLineColumn, pattern AbortEE, pattern AbortFW,
42+
pattern BasicEE, pattern BasicFW, pattern EnvB, pattern LeftB,
43+
pattern PairB, pattern PairP, pattern RightB, pattern SetEnvB,
44+
pattern StuckEE, pattern StuckFW, pattern ZeroB, s2b, tag)
45+
import Telomare.Parser (parseModule, parseOneExprOrTopLevelDefs, parsePrelude)
4746
import Telomare.Possible (SizingSettings (SizingSettings), appB, basicEval,
4847
deferB, evalStaticCheck, getSizesM, sizeTermM,
4948
term3ToUnsizedExpr)

src/Telomare/Parser.hs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ buildMultiLambda :: LocTag -> [(LocTag, PatternA)] -> AUPT -> AUPT
370370
buildMultiLambda lt patterns body =
371371
let varNames = lambdaVarName <$> patterns
372372
destructured = foldr applyDestructure body (zip (snd <$> patterns) (locatedNameText <$> varNames))
373-
lamWrapped = foldr (\v inner -> LamP v inner) destructured varNames
373+
lamWrapped = foldr LamP destructured varNames
374374
in lamWrapped
375375
where
376376
applyDestructure (p, varName) inner =
@@ -705,16 +705,16 @@ runParseLongExpr str = bimap errorBundlePretty convert $ runParser parseLongExpr
705705
convert = UnprocessedParsedTerm . cata f where
706706
f :: C.CofreeF (UnprocessedParsedTermF PatternA) LocTag (Fix (UnprocessedParsedTermF Pattern)) -> Fix (UnprocessedParsedTermF Pattern)
707707
f (_ C.:< f') = embed $ case f' of
708-
UnprocessedParsedTermB x -> UnprocessedParsedTermB x
709-
UnprocessedParsedTermH x -> UnprocessedParsedTermH x
710-
LetUPF bindings x -> LetUPF bindings x
711-
ListUPF x -> ListUPF x
712-
IntUPF n -> IntUPF n
713-
StringUPF s -> StringUPF s
714-
UDTUPF names x -> UDTUPF names x
715-
CaseUPF x matches -> CaseUPF x $ fmap cp matches
716-
ImportQualifiedUPF a b -> ImportQualifiedUPF a b
717-
ImportUPF s -> ImportUPF s
708+
UnprocessedParsedTermB x -> UnprocessedParsedTermB x
709+
UnprocessedParsedTermH x -> UnprocessedParsedTermH x
710+
LetUPF bindings x -> LetUPF bindings x
711+
ListUPF x -> ListUPF x
712+
IntUPF n -> IntUPF n
713+
StringUPF s -> StringUPF s
714+
UDTUPF names x -> UDTUPF names x
715+
CaseUPF x matches -> CaseUPF x $ fmap cp matches
716+
ImportQualifiedUPF a b -> ImportQualifiedUPF a b
717+
ImportUPF s -> ImportUPF s
718718
cp (p, b) = (cata (embed . pf) p, b)
719719
pf = \case
720720
PatternVarF s ->PatternVarF s

src/Telomare/Possible.hs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,19 @@ import Telomare (AbortBase (..), AbortableF (..), AbstractRunTime (..),
6060
RunTimeError (..), StuckBase (..), StuckExpr, StuckExprF,
6161
StuckF (..), TelomareLike (fromTelomare, toTelomare),
6262
Term3 (..), Term3F (..),
63-
UnsizedRecursionToken (UnsizedRecursionToken), pattern AbortAny,
64-
pattern AbortEE, pattern AbortRecursion, pattern AbortUnsizeable, pattern AbortUser, b2i,
65-
pattern BasicEE, convertAbort, convertAbortMessage, convertBasic,
66-
convertStuck, pattern EnvB, pattern FillFunction, forget, pattern GateB, pattern GateSwitch,
67-
i2B, indentWithChildren', indentWithOneChild,
68-
indentWithOneChild', indentWithTwoChildren, pattern FillFunctionEE,
69-
indentWithTwoChildren', pattern LeftB, pattern PairP, pattern AbortAny,
70-
pattern AbortEE, pattern AbortFW, pattern AbortRecursion,
63+
UnsizedRecursionToken (UnsizedRecursionToken), b2i,
64+
convertAbort, convertAbortMessage, convertBasic, convertStuck,
65+
forget, i2B, indentWithChildren', indentWithOneChild,
66+
indentWithOneChild', indentWithTwoChildren,
67+
indentWithTwoChildren', pattern AbortAny, pattern AbortEE,
68+
pattern AbortFW, pattern AbortRecursion,
7169
pattern AbortUnsizeable, pattern AbortUser, pattern AppEE,
72-
pattern BasicEE, pattern BasicFW, pattern FillFunction,
73-
pattern GateSwitch, pattern StuckEE, pattern StuckFW, pattern RightB,
74-
s2b, pattern SetEnvB, sindent, pattern StuckEE, toPartialType, pattern ZeroB, pattern PairB, pattern GateSwitchEE)
70+
pattern BasicEE, pattern BasicFW, pattern EnvB,
71+
pattern FillFunction, pattern FillFunctionEE, pattern GateB,
72+
pattern GateSwitch, pattern GateSwitchEE, pattern LeftB,
73+
pattern PairB, pattern PairP, pattern RightB, pattern SetEnvB,
74+
pattern StuckEE, pattern StuckFW, pattern ZeroB, s2b, sindent,
75+
toPartialType)
7576
import Telomare.PossibleData
7677
-- import Telomare.RunTime (hvmEval)
7778
import Data.Functor.Identity (Identity (Identity), runIdentity)

src/Telomare/Resolver.hs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ import qualified Data.Set as Set
3737
import Debug.Trace (trace, traceShow, traceShowId)
3838
import PrettyPrint (prettyPrint)
3939
import Telomare
40-
import Telomare.Parser (TelomareParser, identifier)
40+
import Telomare.Parser (TelomareParser, identifier)
41+
import Telomare.PossibleData (UnsizedRecursionF (TraceF))
4142
import Text.Megaparsec (errorBundlePretty, runParser)
42-
import Telomare.PossibleData (UnsizedRecursionF(TraceF))
4343

4444
debug :: Bool
4545
debug = False
@@ -107,7 +107,7 @@ varsUPT :: AUPT -> Set String
107107
varsUPT = cata alg where
108108
alg (VarAFP _ n) = Set.singleton n
109109
alg (LamAFP _ str x) = del (locatedNameText str) x
110-
alg e = F.fold e
110+
alg e = F.fold e
111111
del :: String -> Set String -> Set String
112112
del n x = if Set.member n x then Set.delete n x else x
113113

@@ -288,7 +288,7 @@ debruijinize = ($ []) . runReaderT . cata f where
288288
findElem :: LocTag -> String -> [LamType String] -> m Term2
289289
findElem anno n vl = case find (ff n) (zip [0..] vl) of
290290
Just (i, _) -> pure $ VarP i
291-
_ -> fail $ "undefined identifier " <> n
291+
_ -> fail $ "undefined identifier " <> n
292292
ff n = \case
293293
(_, Open n') | n' == n -> True
294294
(_, Closed n') | n' == n -> True
@@ -344,9 +344,9 @@ splitExpr = flip State.evalState (toEnum 0, toEnum 0) . cata f where
344344
ParserTermB ZeroSF -> pure ZeroB
345345
ParserTermB (PairSF a b) -> pairS a b
346346
ParserTermL x -> case x of
347-
VarF n -> pure $ varB n
348-
AppF c i -> appS c i
349-
LamF (Open ()) x -> lamS x
347+
VarF n -> pure $ varB n
348+
AppF c i -> appS c i
349+
LamF (Open ()) x -> lamS x
350350
LamF (Closed ()) x -> clamS x
351351
ParserTermH h -> case h of
352352
CheckF tc c -> (\tc' c' -> anno :< Term3CheckingWrapper anno tc' c') <$> tc <*> c
@@ -601,8 +601,8 @@ optimizeBuiltinFunctions = cata f where
601601
twoApp@(AppAFP a (GFix (AppAFP _ f x)) y) ->
602602
case project f of
603603
VarAFP _ "pair" -> embed $ PairAFP a x y
604-
VarAFP _ "app" -> embed $ AppAFP a x y
605-
_ -> embed twoApp
604+
VarAFP _ "app" -> embed $ AppAFP a x y
605+
_ -> embed twoApp
606606
oneApp@(AppAFP a f x) ->
607607
case project f of
608608
VarAFP _ "left" -> HLeft x

src/Telomare/TypeChecker.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ import Control.Monad.State (State)
1212
import qualified Control.Monad.State as State
1313
import Data.Bifunctor (second)
1414
import qualified Data.DList as DList
15+
import Data.Fix (Fix (..))
1516
import Data.Foldable (fold)
1617
import Data.Functor.Foldable
18+
import Data.List (nub, sort)
1719
import Data.Map (Map)
1820
import qualified Data.Map as Map
1921
import Data.Semigroup (Max (..))
@@ -22,12 +24,10 @@ import qualified Data.Set as Set
2224
import Debug.Trace
2325
import PrettyPrint
2426
import Telomare (AbortableF (..), BasicExprF (..),
25-
FunctionIndex (FunctionIndex), LocTag (..), PartialTypeF (..), PartialType,
26-
StuckF (..), Term3, Term3F (..), TypeCheckError (..),
27-
pattern AbortFW, pattern BasicFW,
27+
FunctionIndex (FunctionIndex), LocTag (..), PartialType,
28+
PartialTypeF (..), StuckF (..), Term3, Term3F (..),
29+
TypeCheckError (..), pattern AbortFW, pattern BasicFW,
2830
pattern StuckFW)
29-
import Data.List (sort, nub)
30-
import Data.Fix (Fix(..))
3131

3232
debug :: Bool
3333
debug = False

0 commit comments

Comments
 (0)