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

Add a few strictness annotations

parent 1b22b1ea
{-# LANGUAGE Strict #-}
module MA.FunctorExpression.Desorting
( Desorted
, desort
......
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
......@@ -56,16 +57,16 @@ parseMorphismPointHelper ::
-> m w
-> m (w, Vector (x, w))
parseMorphismPointHelper inner weightParser = do
successors <- V.sortOn fst . V.fromList <$> L.braces (edge `sepBy` L.comma)
!successors <- V.sortOn fst . V.fromList <$> L.braces (edge `sepBy` L.comma)
when (V.hasDuplicates (fmap fst successors)) $
fail "monoid valued: Duplicate edges"
let h1 = V.sum (V.map snd successors)
let !h1 = V.sum (V.map snd successors)
return (h1, successors)
where
edge = (,) <$> inner <* L.colon <*> (L.signed weightParser)
edge = (,) <$> inner <*> (L.colon *> (L.signed weightParser))
{-# INLINE parseMorphismPointHelper #-}
{-# SPECIALIZE parseMorphismPointHelper :: MonadParser m => m Int -> m Int -> m (Int, Vector (Int, Int)) #-}
{-# SPECIALIZE parseMorphismPointHelper :: MonadParser m => m Int -> m Double -> m (Double, Vector (Int, Double)) #-}
......
......@@ -4,6 +4,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StrictData #-}
-- | Polynomial functor with co-products, products, exponentials and constants
module MA.Functors.Polynomial
......
......@@ -2,6 +2,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE Strict #-}
module MA.Functors.SomeFunctor
( SomeFunctor
, someFunctor
......
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