Skip to content

Commit

Permalink
Stop let generalization in benchmark-vector-algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
facundominguez committed Nov 18, 2023
1 parent e0a1b61 commit 795f905
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# OPTIONS_GHC -Wno-partial-type-signatures #-}
{-# LANGUAGE PartialTypeSignatures, FlexibleContexts, ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE MonoLocalBinds #-}

-- ---------------------------------------------------------------------------
-- |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE MonoLocalBinds #-}

-- ---------------------------------------------------------------------------
-- |
Expand Down Expand Up @@ -173,12 +174,12 @@ inc arr i = unsafeRead arr i >>= \e -> unsafeWrite arr i (e+1) >> return e
countLoop :: (PrimMonad m, MVector v e)
=> (v (PrimState m) e) -> (PV.MVector (PrimState m) Int)
-> (e -> Int) -> m ()
countLoop src count rdx = set count 0 >> go len 0
countLoop src count rdx = set count 0 >> go src len 0
where
len = length src
go (m :: Int) i
go v (m :: Int) i
| i < len = let lenSrc = length src
in ({- liquidAssert (i < lenSrc) $ -} unsafeRead src i) >>= inc count . rdx >> go (m-1) (i+1)
in ({- liquidAssert (i < lenSrc) $ -} unsafeRead v i) >>= inc count . rdx >> go (m-1) (i+1)
| otherwise = return ()
{-# INLINE countLoop #-}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE MonoLocalBinds #-}

-- ---------------------------------------------------------------------------
-- |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# OPTIONS_GHC -Wno-partial-type-signatures #-}
{-# LANGUAGE PartialTypeSignatures, TypeOperators, BangPatterns, ScopedTypeVariables #-}
{-# LANGUAGE MonoLocalBinds #-}

-- ---------------------------------------------------------------------------
-- |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE MonoLocalBinds #-}

-- ---------------------------------------------------------------------------
-- |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-@ LIQUID "--no-totality" @-}
{-# LANGUAGE ScopedTypeVariables, BangPatterns, TypeOperators #-}
{-# LANGUAGE MonoLocalBinds #-}

-- ---------------------------------------------------------------------------
-- |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE MonoLocalBinds #-}

-- ---------------------------------------------------------------------------
-- |
Expand Down

0 comments on commit 795f905

Please sign in to comment.