Commit e2fc7b4e authored by Hans-Peter Deifel's avatar Hans-Peter Deifel
Browse files

Implement NFData for for Label and H1 of SomeFunctor

This is used by the micro-benchmark suite
parent 4c51fd56
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleInstances #-}
......@@ -11,12 +12,14 @@ import Prelude hiding (init)
import Type.Reflection
import Data.Maybe (mapMaybe)
import Control.DeepSeq (NFData(..))
import MA.RefinementInterface
import MA.Coalgebra.RefinementTypes
import MA.FunctorExpression.Parser
import MA.Coalgebra.Parser
type Suitable f = (RefinementInterface f, Functor f, Foldable f, Traversable f)
type Suitable f = (RefinementInterface f, Functor f, Foldable f, Traversable f, NFData (H1 f), NFData (Label f))
data SomeFunctor a where
SomeFunctor
......@@ -35,13 +38,16 @@ someFunctor ::
someFunctor = transParser SomeFunctor
data SomeLabel where
SomeLabel :: Suitable f => TypeRep f -> Label f -> SomeLabel
SomeLabel :: (Suitable f) => TypeRep f -> Label f -> SomeLabel
instance NFData SomeLabel where
rnf (SomeLabel !_ !inner) = rnf inner
data SomeWeight where
SomeWeight :: Suitable f => TypeRep f -> Weight f -> SomeWeight
data SomeH1 where
SomeH1 :: Suitable f => TypeRep f -> H1 f -> SomeH1
SomeH1 :: (Suitable f) => TypeRep f -> H1 f -> SomeH1
instance Eq SomeH1 where
(SomeH1 f1 a) == (SomeH1 f2 b) = case eqTypeRep f1 f2 of
......@@ -53,6 +59,9 @@ instance Ord SomeH1 where
Nothing -> compare @Int 1 2 -- XXX: should not happen
Just HRefl -> compare a b
instance NFData SomeH1 where
rnf (SomeH1 !_ !inner) = rnf inner
data SomeH3 where
SomeH3 :: Suitable f => TypeRep f -> H3 f -> SomeH3
......
Supports Markdown
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