Commit 1b638784 authored by Jente Hidskes's avatar Jente Hidskes

Stratego: fix HLint errors

parent deebb073
# HLint configuration file
# https://github.com/ndmitchell/hlint
##########################
# Ignore some builtin hints
- ignore: {name: "Use lambda-case"}
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveGeneric #-}
module Data.Powerset where module Data.Powerset where
import Prelude hiding (map,(.),id) import Prelude hiding ((.))
import Control.Category import Control.Category
import Control.Applicative import Control.Applicative
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
module Main where module Main where
import Prelude hiding (log)
import Syntax hiding (Fail) import Syntax hiding (Fail)
import qualified WildcardSemantics as W import qualified WildcardSemantics as W
import qualified Data.AbstractPowerset as W import qualified Data.AbstractPowerset as W
...@@ -31,7 +29,7 @@ import qualified Data.Term as T ...@@ -31,7 +29,7 @@ import qualified Data.Term as T
import System.IO import System.IO
import Text.PrettyPrint hiding (sep,(<>)) import Text.PrettyPrint
import Text.Printf import Text.Printf
main :: IO () main :: IO ()
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Pretty.PCF where module Pretty.PCF where
import WildcardSemantics import WildcardSemantics
import Text.PrettyPrint hiding (sep) import Text.PrettyPrint
ppPCF :: Term -> Doc ppPCF :: Term -> Doc
ppPCF t = case t of ppPCF t = case t of
......
...@@ -4,8 +4,7 @@ import WildcardSemantics ...@@ -4,8 +4,7 @@ import WildcardSemantics
import Data.Foldable import Data.Foldable
import Text.PrettyPrint hiding (sep) import Text.PrettyPrint
ppResults :: (Functor f, Foldable f) => (Term -> Doc) -> f Term -> Doc ppResults :: (Functor f, Foldable f) => (Term -> Doc) -> f Term -> Doc
ppResults ppTerm res = braces ppResults ppTerm res = braces
......
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE PatternSynonyms #-}
module AbstractTypedSemantics where module AbstractTypedSemantics where
import Prelude hiding (id,(.),fail,all) import Prelude hiding (fail)
import InterpreterArrow import InterpreterArrow
import WildcardSemantics hiding (Term(..),TermEnv) import WildcardSemantics hiding (Term(..),TermEnv)
import Sort import Sort
import Signature hiding (lookupType) import Signature
import qualified Signature as Sig import qualified Signature as Sig
import Syntax(Strat,StratEnv,Module,signature,stratEnv) import Syntax(Strat,StratEnv,Module,signature,stratEnv)
import Utils import Utils
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
{-# OPTIONS_GHC -Wno-partial-type-signatures #-} {-# OPTIONS_GHC -Wno-partial-type-signatures #-}
module ConcreteSemantics where module ConcreteSemantics where
import Prelude hiding (id,(.),all,curry,uncurry) import Prelude hiding ((.),uncurry)
-- import InterpreterArrow -- import InterpreterArrow
import SharedSemantics import SharedSemantics
...@@ -32,18 +32,15 @@ import Control.Monad.Reader ...@@ -32,18 +32,15 @@ import Control.Monad.Reader
import Control.Monad.State import Control.Monad.State
import Data.Constructor import Data.Constructor
import Data.Foldable (foldr')
import Data.HashMap.Lazy (HashMap)
import qualified Data.HashMap.Lazy as M
import Data.Hashable
import Data.Result import Data.Result
import Data.String (IsString(..)) import Data.String (IsString(..))
import Data.Term (IsTerm(..),TermUtils(..)) import Data.Term (IsTerm(..),TermUtils(..))
import Data.TermEnv import Data.TermEnv
import Data.Text (Text) import Data.Text (Text)
import Data.Order
import Data.Stack
import Data.Complete
import Data.Foldable (foldr')
import Data.Hashable
import Data.HashMap.Lazy (HashMap)
import qualified Data.HashMap.Lazy as M
import Test.QuickCheck hiding (Result(..)) import Test.QuickCheck hiding (Result(..))
......
...@@ -27,7 +27,7 @@ apply a = do ...@@ -27,7 +27,7 @@ apply a = do
k <- get k <- get
let b = g k a let b = g k a
case M.lookup b (l k) of case M.lookup b (l k) of
Just c | otherwise -> do Just c -> do
let c' = f k a c let c' = f k a c
put (k {l = M.insert b c' (l k)}) put (k {l = M.insert b c' (l k)})
return c' return c'
......
{-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FunctionalDependencies #-}
module Data.Term where module Data.Term where
import Prelude hiding (fail)
import Data.Constructor import Data.Constructor
import Data.Text(Text) import Data.Text(Text)
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
{-# LANGUAGE Arrows #-} {-# LANGUAGE Arrows #-}
module Data.TermEnv where module Data.TermEnv where
import Prelude hiding ((.),id,map)
import Syntax (TermVar) import Syntax (TermVar)
import Control.Category import Control.Category
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}
module GrammarSemantics where module GrammarSemantics where
import Prelude hiding (fail,all,zipWith,id,(.)) import Prelude hiding (fail,all,id,(.))
import Result import Result
import Syntax (Strat(..),Constructor(..),TermVar,StratEnv,TermPattern) import Syntax (Strat(..),Constructor(..),TermVar,StratEnv,TermPattern)
import qualified Syntax as S import qualified Syntax as S
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ConstraintKinds #-}
module SharedSemantics where module SharedSemantics where
import Prelude hiding (fail,(.),id,sum,flip,uncurry,all,sequence) import Prelude hiding (id,all,sequence)
import Syntax hiding (Fail,TermPattern(..)) import Syntax hiding (Fail,TermPattern(..))
import Syntax (TermPattern) import Syntax (TermPattern)
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
module Signature(Signature, HasSignature(..), Sort(..), Fun(..), SortId(..), module Signature(Signature, HasSignature(..), Sort(..), Fun(..), SortId(..),
empty, insertType, lookupType, insertSubtype, subtype, inhabitants) where empty, insertType, lookupType, insertSubtype, subtype, inhabitants) where
import Prelude hiding (lookup)
import Sort import Sort
import SubtypeRelation (SubtypeRelation) import SubtypeRelation (SubtypeRelation)
import qualified SubtypeRelation as R import qualified SubtypeRelation as R
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Syntax where module Syntax where
import Prelude hiding (maybe)
import Signature (Signature,Sort,Fun) import Signature (Signature,Sort,Fun)
import qualified Signature as I import qualified Signature as I
......
...@@ -5,12 +5,10 @@ ...@@ -5,12 +5,10 @@
{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE MultiParamTypeClasses #-}
module TypedSemantics where module TypedSemantics where
import Prelude hiding (id,(.),fail,all)
import InterpreterArrow import InterpreterArrow
import ConcreteSemantics hiding (Term(..),TermEnv,eval) import ConcreteSemantics hiding (Term(..),TermEnv,eval)
import Sort import Sort
import Signature hiding (lookupType,lub) import Signature hiding (lub)
import qualified Signature as Sig import qualified Signature as Sig
import Syntax(Module,Strat,StratEnv,stratEnv,signature) import Syntax(Module,Strat,StratEnv,stratEnv,signature)
import Utils import Utils
...@@ -44,7 +42,7 @@ eval :: Signature -> StratEnv -> Strat -> (Term,TermEnv) -> TypedResult (Term,Te ...@@ -44,7 +42,7 @@ eval :: Signature -> StratEnv -> Strat -> (Term,TermEnv) -> TypedResult (Term,Te
eval sig senv s = runInterp (eval' s) (sig, senv) eval sig senv s = runInterp (eval' s) (sig, senv)
instance HasTerm Term (Interp (Signature,senv) s TypedResult) where instance HasTerm Term (Interp (Signature,senv) s TypedResult) where
matchTerm = arr $ \t -> case t of matchTerm = arr $ \case
Cons c ts _ -> T.Cons c ts Cons c ts _ -> T.Cons c ts
StringLiteral s -> T.StringLiteral s StringLiteral s -> T.StringLiteral s
NumberLiteral n -> T.NumberLiteral n NumberLiteral n -> T.NumberLiteral n
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleInstances #-}
module Utils where module Utils where
import Prelude hiding (id)
import Control.Arrow import Control.Arrow
eqLength :: [a] -> [b] -> Bool eqLength :: [a] -> [b] -> Bool
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
{-# OPTIONS_GHC -Wno-partial-type-signatures -fno-warn-orphans #-} {-# OPTIONS_GHC -Wno-partial-type-signatures -fno-warn-orphans #-}
module WildcardSemantics where module WildcardSemantics where
import Prelude hiding (id,concat,sequence,(.),uncurry) import Prelude hiding ((.),uncurry)
import qualified ConcreteSemantics as C import qualified ConcreteSemantics as C
import SharedSemantics import SharedSemantics
......
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
module AbstractTypedSemanticsSpec where module AbstractTypedSemanticsSpec where
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
module ConcreteSemanticsSpec(main, spec) where module ConcreteSemanticsSpec(main, spec) where
import Prelude hiding (map) import Prelude hiding (map)
import qualified Prelude as P
import ConcreteSemantics import ConcreteSemantics
import Syntax hiding (Fail,TermPattern(..)) import Syntax hiding (Fail,TermPattern(..))
...@@ -149,9 +148,7 @@ spec = do ...@@ -149,9 +148,7 @@ spec = do
parseArrowCaseStudy = do parseArrowCaseStudy = do
file <- TIO.readFile =<< getDataFileName "case-studies/arrows/arrows.aterm" file <- TIO.readFile =<< getDataFileName "case-studies/arrows/arrows.aterm"
case parseModule =<< parseATerm file of case parseModule =<< parseATerm file of
Left e -> P.fail (show e) Left e -> fail (show e)
Right module_ -> return module_ Right module_ -> return module_
tup x y = Cons "" [x,y] tup x y = Cons "" [x,y]
...@@ -9,8 +9,6 @@ import qualified Data.Powerset as P ...@@ -9,8 +9,6 @@ import qualified Data.Powerset as P
import qualified Data.AbstractPowerset as A import qualified Data.AbstractPowerset as A
import Test.Hspec import Test.Hspec
import Test.Hspec.QuickCheck
import Test.QuickCheck hiding (Result(..))
main :: IO () main :: IO ()
main = hspec spec main = hspec spec
......
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
module TypedSemanticsSpec where module TypedSemanticsSpec where
......
...@@ -124,4 +124,4 @@ spec = do ...@@ -124,4 +124,4 @@ spec = do
(Build (Cons "Nil" [])))) (Build (Cons "Nil" []))))
weval :: Int -> Strat -> W.Term -> A.Pow (Result (W.Term,W.TermEnv)) weval :: Int -> Strat -> W.Term -> A.Pow (Result (W.Term,W.TermEnv))
weval i s t = W.eval i s M.empty (W.TermEnv M.empty) t weval i s = W.eval i s M.empty (W.TermEnv M.empty)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment