Commit bc4e88c5 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel 🐢

Fix lots of GHC warnings

parent 08a648dc
......@@ -16,31 +16,29 @@ import Data.Proxy
import Control.Exception
import qualified Copar.Parser as P
import qualified Data.MorphismEncoding as Encoding
import Copar.Functors.GroupValued (GroupValued(GroupValued))
import Copar.Functors.Powerset (Powerset(Powerset))
import Text.Megaparsec (parse)
import Text.Megaparsec.Error (errorBundlePretty)
import Copar.FunctorExpression.Sorts
import Copar.FunctorExpression.Desorting (Desorted(..))
import Copar.FunctorExpression.Desorting (Desorted)
import Copar.FunctorExpression.Type
import Copar.RefinementInterface (RefinementInterface, Label, F1)
import Copar.RefinementInterface (Label, F1)
import Copar.Timing
import Copar.Coalgebra.Parser (morphismsParser)
import Copar.Coalgebra.Parser (SymbolTable, morphismsParser)
import qualified Data.Text.IO as TextIO
import Data.Bifunctor
import Data.Float.Utils (EqDouble)
import Data.Partition (Partition)
import Data.MorphismEncoding (Encoding)
{-# SPECIALIZE refineWithStats :: Proxy (Desorted Powerset) -> Encoding.Encoding (Label (Desorted Powerset)) (F1 (Desorted Powerset)) -> Bool -> IO (Partition, AlgoStatistics) #-}
main :: Stats -> Maybe [Char] -> (Encoding (Sorted ()) (Sorted Bool) -> SymbolTable -> Partition -> IO a) -> Bool -> IO ()
main stats inputFile partitionPrinter enableOptimizations = do
withTimeStat stats "overall-duration" $ do
let myfunctor = (annotateSorts $ Functor () (Powerset Variable))
-- let mp = morphismsParser @(GroupValued EqDouble)
let mp = morphismsParser @(Powerset)
let morphParser = mp myfunctor P.DisableSanityChecks
let f = myfunctor
(symbolTable, encoding) <- withTimeStat stats "parse-duration" $ do
let (filename,getFilecontents) = case inputFile of
Nothing -> ("(stdin)", TextIO.getContents)
......
......@@ -7,21 +7,16 @@
module Main (main) where
import Control.Arrow ((***))
import Control.Exception (evaluate)
import Control.Monad.ST
import Data.IORef
import Data.List (sortOn)
import System.Exit
import System.IO
import System.Environment
import Data.Map (Map)
import qualified Data.Map as M
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Lazy as LT
import qualified Data.Text.Lazy.IO as LT
import Data.Text.Prettyprint.Convert.AnsiWlPprint
import Data.Text.Prettyprint
......@@ -29,8 +24,6 @@ import qualified Data.Text.Lazy.Builder as Build
import Data.Proxy
import qualified Data.Vector as V
import Options.Applicative
import Text.JSON
import Text.Show.Pretty (pPrint)
import Copar.Algorithm
import qualified Copar.Parser as P
......@@ -47,7 +40,6 @@ import Copar.FunctorExpression.Desorting (Desorted)
import Copar.Dot
import Copar.RewriteFunctors
import Copar.Timing
import Copar.Functors
import Copar.CoalgebraPrinter
import qualified Hardwired as Hardwired
......@@ -456,7 +448,7 @@ main = do
stats <- initStats (refineStats r) (refineStatsJson r)
withTimeStat stats "overall-duration" $ do
(f, (symbolTable, encoding)) <- withTimeStat stats "parse-duration" $ do
(_, (symbolTable, encoding)) <- withTimeStat stats "parse-duration" $ do
let transPolicy = if refineApplyTransformations r
then P.ApplyTransformations
......@@ -558,7 +550,7 @@ main = do
LT.putStrLn $ Build.toLazyText $ printEncoding encoding symbolTable (sortTable f)
(PrettyPrintCommand r) -> do
(f, (symbolTable, encoding)) <- do
(_, (_symbolTable, _encoding)) <- do
let parserConfig = P.Config
{ functorTransforms = P.DontApplyTransformations
, sanityChecks = P.DisableSanityChecks
......
......@@ -5,8 +5,6 @@ import Test.Hspec
import Data.Functor.Classes
import Data.Functor.Identity
import Data.Monoid
import Type.Reflection
import qualified Data.Vector as V
......
......@@ -2,7 +2,6 @@ module Copar.FunctorPrinterSpec (spec) where
import Test.Hspec
import Data.Bifunctor
import Data.Either
import Data.Text (unpack, Text)
......
......@@ -41,7 +41,7 @@ e :: a -> [Text] -> Factor a
e inner = Exponential inner . ExplicitExp . V.fromList
-- Used to abstract over the behavior of `Desorted`.
data PolyData a = PolyData
data PolyData a
type instance Label PolyData = (Int, Maybe ())
type instance Weight PolyData = ()
type instance F1 PolyData = (Int, Vector (Maybe ()), Vector Int)
......@@ -295,4 +295,5 @@ f1 s v c = (s, V.fromList v, V.fromList c)
v :: [a] -> Vector a
v = V.fromList
mkLabel = mkDesortedLabel @PolyData
\ No newline at end of file
mkLabel :: Sorted (Label PolyData) -> Label (Desorted PolyData)
mkLabel = mkDesortedLabel @PolyData
......@@ -24,10 +24,14 @@ import qualified Data.Partition as Part
import Copar.Coalgebra.Parser
import Copar.RefinementInterface
import Copar.FunctorExpression.Desorting
import Copar.FunctorExpression.Sorts
import Copar.FunctorExpression.Type
import Copar.Functors.Polynomial
import Copar.FunctorExpression.Parser
import Copar.FunctorDescription
import Text.Megaparsec.Error (ParseErrorBundle)
import Data.Void (Void)
import Data.MorphismEncoding (Encoding)
spec :: Spec
spec = do
......@@ -190,6 +194,7 @@ c = Const . ExplicitSet . V.fromList
e :: a -> [Text] -> Factor a
e inner = Exponential inner . ExplicitExp . V.fromList
morphp :: (Functor f, ParseMorphism f) => f (FunctorExpression f Sort) -> Text -> Either (ParseErrorBundle Text Void) (Encoding (Sorted (Label f)) (Sorted (F1 f)))
morphp fexpr input = snd <$> parseMorphisms (Functor 1 fexpr) EnableSanityChecks "" input
parseMorphismPointSpec :: Spec
......@@ -391,4 +396,4 @@ v :: [a] -> Vector a
v = V.fromList
mkLabel :: Sorted (Label Polynomial) -> Label (Desorted Polynomial)
mkLabel = mkDesortedLabel @Polynomial
\ No newline at end of file
mkLabel = mkDesortedLabel @Polynomial
{-# OPTIONS_GHC -Wno-orphans #-}
module Data.Float.UtilsSpec (spec) where
import Test.Hspec
......
......@@ -6,7 +6,6 @@ import Test.Hspec
import Data.List (sort)
import Data.Partition
import Data.Partition.Common
spec :: Spec
spec = do
......
......@@ -4,7 +4,6 @@
module Main (main) where
import Control.Monad.ST
import Control.Exception (evaluate)
import Data.List
import Data.Proxy
......@@ -56,7 +55,7 @@ testFileRefine outfile =
P.readFile P.defaultConfig file
>>= \case
Left err -> return err
Right (f, (symTab, enc)) -> do
Right (_, (symTab, enc)) -> do
partition <- stToIO (refine (Proxy :: Proxy (Desorted SomeFunctor)) enc True)
return $ T.unpack (showPartition enc symTab partition)
......
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