Skip to content

Commit

Permalink
Merge pull request #220 from noinia/fixlseq
Browse files Browse the repository at this point in the history
fix compile issues on 9.4
  • Loading branch information
noinia authored Dec 18, 2022
2 parents ddc7d45 + e2b4c97 commit f8cdbc0
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cabal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
ghc: ['8.10','9.2']
ghc: ['9.2','9.4']
os: [ubuntu-latest, macOS-latest]
name: GHC ${{ matrix.ghc }} / ${{ matrix.os }}
steps:
Expand Down
6 changes: 6 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ package miso
flags: +jsaddle
package reanimate
flags: +no-hgeometry

allow-newer:
vector-circular:base,vector-circular:template-haskell,
reanimate:aeson,
geojson:text,
hexpat:text
2 changes: 1 addition & 1 deletion hgeometry-combinatorial/hgeometry-combinatorial.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ common setup
, DerivingStrategies

build-depends:
base >= 4.11 && < 5
base >= 4.16 && < 5
, array >= 0.4
, bifunctors >= 4.1
, bytestring >= 0.10
Expand Down
17 changes: 12 additions & 5 deletions hgeometry-combinatorial/src/Data/LSeq.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE BangPatterns #-}
--------------------------------------------------------------------------------
-- |
Expand Down Expand Up @@ -47,7 +48,7 @@ import Control.DeepSeq
import Control.Lens ((%~), (&), (<&>), (^?!), bimap)
import Control.Lens.At (Ixed(..), Index, IxValue)
import Data.Aeson
import Data.Coerce(coerce)
import Data.Coerce (coerce)
import qualified Data.Foldable as F
import Data.Functor.Apply
import qualified Data.List.NonEmpty as NonEmpty
Expand All @@ -56,6 +57,7 @@ import Data.Semigroup.Foldable
import Data.Semigroup.Traversable
import qualified Data.Sequence as S
import qualified Data.Traversable as Tr
import Data.Type.Ord
import GHC.Generics (Generic)
import GHC.TypeLits
import Prelude hiding (drop,take,head,last,tail,init,zipWith,reverse)
Expand Down Expand Up @@ -259,8 +261,13 @@ data ViewL n a where

infixr 5 :<

instance Semigroup (ViewL n a) where
(x :< xs) <> (y :< ys) = x :< LSeq (toSeq xs <> (y S.<| toSeq ys))
instance (n ~ 1 + n0) => Semigroup (ViewL n a) where
(<>) = combineL

-- | implementation of <> for viewL
combineL :: forall n a. ViewL (1+n) a -> ViewL (1+n) a -> ViewL (1+n) a
combineL (x :< xs) (y :< ys) = x :< promise @n (LSeq (toSeq xs <> (y S.<| toSeq ys)))


deriving instance Show a => Show (ViewL n a)
instance Functor (ViewL n) where
Expand Down Expand Up @@ -327,8 +334,8 @@ data ViewR n a where

infixl 5 :>

instance Semigroup (ViewR n a) where
(xs :> x) <> (ys :> y) = LSeq ((toSeq xs S.|> x) <> toSeq ys) :> y
instance (n ~ 1+n0) => Semigroup (ViewR n a) where
(xs :> x) <> (ys :> y) = promise @n0 (LSeq ((toSeq xs S.|> x) <> toSeq ys)) :> y

deriving instance Show a => Show (ViewR n a)
instance Functor (ViewR n) where
Expand Down
5 changes: 2 additions & 3 deletions hgeometry-ipe/stack-haddock.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-18.25
resolver: lts-20.04

allow-newer: false

Expand All @@ -7,5 +7,4 @@ packages:
- ../hgeometry-combinatorial
- ../hgeometry

extra-deps:
- vector-circular-0.1.4
# extra-deps:
1 change: 1 addition & 0 deletions hgeometry/src/Geometry/RangeTree.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}
--------------------------------------------------------------------------------
-- |
-- Module : Geometry.RangeTree
Expand Down

0 comments on commit f8cdbc0

Please sign in to comment.