Skip to content
Snippets Groups Projects
Commit 89fdbda0 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel
Browse files

Lift show requirements from RefinementInterface

If needed, Show should be required at a different place.
RefinementInterface should now represent exactly what's described in
the paper.
parent 4620c8c0
Branches
No related tags found
No related merge requests found
...@@ -40,15 +40,9 @@ instance Show (SomeFunctor ()) where ...@@ -40,15 +40,9 @@ instance Show (SomeFunctor ()) where
data SomeLabel where data SomeLabel where
SomeLabel :: RefinementInterface f => TypeRep f -> Label f -> SomeLabel SomeLabel :: RefinementInterface f => TypeRep f -> Label f -> SomeLabel
instance Show SomeLabel where
show (SomeLabel _ l) = show l
data SomeWeight where data SomeWeight where
SomeWeight :: RefinementInterface f => TypeRep f -> Weight f -> SomeWeight SomeWeight :: RefinementInterface f => TypeRep f -> Weight f -> SomeWeight
instance Show SomeWeight where
show (SomeWeight _ w) = show w
data SomeH1 where data SomeH1 where
SomeH1 :: RefinementInterface f => TypeRep f -> H1 f -> SomeH1 SomeH1 :: RefinementInterface f => TypeRep f -> H1 f -> SomeH1
...@@ -62,9 +56,6 @@ instance Ord SomeH1 where ...@@ -62,9 +56,6 @@ instance Ord SomeH1 where
Nothing -> compare @Int 1 2 -- XXX: should not happen Nothing -> compare @Int 1 2 -- XXX: should not happen
Just HRefl -> compare a b Just HRefl -> compare a b
instance Show SomeH1 where
show (SomeH1 _ w) = show w
data SomeH3 where data SomeH3 where
SomeH3 :: RefinementInterface f => TypeRep f -> H3 f -> SomeH3 SomeH3 :: RefinementInterface f => TypeRep f -> H3 f -> SomeH3
......
...@@ -7,16 +7,8 @@ module Data.RefinementInterface where ...@@ -7,16 +7,8 @@ module Data.RefinementInterface where
import MA.Coalgebra.RefinementTypes import MA.Coalgebra.RefinementTypes
class ( Show (h ()) class (Ord (H1 h), Ord (H3 h), Functor h, Foldable h, Traversable h) =>
, Show (Label h) RefinementInterface (h :: * -> *)
, Show (H1 h) where
, Show (Weight h)
, Ord (H1 h)
, Ord (H3 h)
, Functor h
, Foldable h
, Traversable h
) => RefinementInterface (h :: * -> *) where
init :: H1 h -> [Label h] -> Weight h init :: H1 h -> [Label h] -> Weight h
update :: [Label h] -> Weight h -> (Weight h, H3 h, Weight h) update :: [Label h] -> Weight h -> (Weight h, H3 h, Weight h)
...@@ -7,8 +7,6 @@ module MA.FunctorExpression.Desorting ...@@ -7,8 +7,6 @@ module MA.FunctorExpression.Desorting
import Prelude hiding (init) import Prelude hiding (init)
import Data.Functor.Classes
import MA.FunctorExpression.Type import MA.FunctorExpression.Type
import MA.FunctorExpression.Sorts import MA.FunctorExpression.Sorts
import Data.RefinementInterface import Data.RefinementInterface
...@@ -25,7 +23,7 @@ type instance Label (Desorted f) = (Sort, Label f) ...@@ -25,7 +23,7 @@ type instance Label (Desorted f) = (Sort, Label f)
type instance Weight (Desorted f) = (Sort, Weight f) type instance Weight (Desorted f) = (Sort, Weight f)
type instance H3 (Desorted f) = (Sort, H3 f) type instance H3 (Desorted f) = (Sort, H3 f)
instance (RefinementInterface f, Show1 f) => RefinementInterface (Desorted f) where instance RefinementInterface f => RefinementInterface (Desorted f) where
init (sort, h1) labels = (sort, init @f h1 (filterBySort sort labels)) init (sort, h1) labels = (sort, init @f h1 (filterBySort sort labels))
update labels (sort, w) = update labels (sort, w) =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment