Skip to content

Commit

Permalink
Fix type errors, try to maintain backwards compat.
Browse files Browse the repository at this point in the history
generics-sop >= 0.4 will only build with GHC >8, I'm not sure how important that
constraint is to this package but I've tried to preserve with some CPP guards to
use the correct constraints.
  • Loading branch information
mankyKitty committed Feb 4, 2019
1 parent 7c94846 commit e5c5602
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 18 additions & 1 deletion test/URI/ByteString/Arbitrary.hs
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
Expand All @@ -11,7 +12,10 @@ module URI.ByteString.Arbitrary where
import Control.Applicative
import Data.Proxy (Proxy (..))
import qualified Generics.SOP as SOP
#if MIN_VERSION_generics_sop(0,4,0)
#else
import qualified Generics.SOP.Constraint as SOP
#endif
import qualified Generics.SOP.GGP as SOP
import GHC.Generics (Generic)
import Test.QuickCheck
Expand All @@ -29,15 +33,28 @@ sopArbitrary
:: ( SOP.SListI (SOP.GCode b)
, Generic b
, SOP.GTo b
#if MIN_VERSION_generics_sop(0,4,0)
, SOP.All SOP.SListI (SOP.GCode b)
, SOP.All (SOP.All Arbitrary) (SOP.GCode b)
#else
, SOP.AllF SOP.SListI (SOP.GCode b)
, SOP.AllF (SOP.All Arbitrary) (SOP.GCode b)
#endif
)
=> Gen b
sopArbitrary = fmap SOP.gto sopArbitrary'


sopArbitrary'
:: (SOP.SListI xs, SOP.AllF (SOP.All Arbitrary) xs, SOP.AllF SOP.SListI xs)
:: ( SOP.SListI xs
#if MIN_VERSION_generics_sop(0,4,0)
, SOP.All SOP.SListI xs
, SOP.All (SOP.All Arbitrary) xs
#else
, SOP.AllF SOP.SListI xs
, SOP.AllF (SOP.All Arbitrary) xs
#endif
)
=> Gen (SOP.SOP SOP.I xs)
sopArbitrary' = oneof (map SOP.hsequence $ SOP.apInjs_POP $ SOP.hcpure p arbitrary)
where
Expand Down
4 changes: 2 additions & 2 deletions uri-bytestring.cabal
@@ -1,5 +1,5 @@
name: uri-bytestring
version: 0.3.2.1
version: 0.3.2.2
synopsis: Haskell URI parsing as ByteStrings
description: uri-bytestring aims to be an RFC3986 compliant URI parser that uses efficient ByteStrings for parsing and representing the URI data.
license: BSD3
Expand Down Expand Up @@ -89,7 +89,7 @@ test-suite test
, semigroups
, transformers
, containers
, generics-sop >= 0.2
, generics-sop >= 0.3 && < 0.5
default-language: Haskell2010

if flag(lib-Werror)
Expand Down

0 comments on commit e5c5602

Please sign in to comment.