Skip to content

Commit

Permalink
conditional semigroup for vector
Browse files Browse the repository at this point in the history
  • Loading branch information
ersran9 committed Dec 19, 2018
1 parent f03d277 commit 5886eb3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
13 changes: 13 additions & 0 deletions stack-ghc-8.4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
packages:
- 'webapi'
- 'webapi-docs'
- 'webapi-contract'
- 'webapi-swagger'
- location:
git: https://github.com/capital-match/bytestring-trie.git
commit: 47526b2ec810239fe824c03c13cf1d81f0741b5c
extra-dep: true
resolver: lts-12.24

extra-deps:
- multiset-0.3.4.1
7 changes: 1 addition & 6 deletions stack-ghc-8.6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,5 @@ packages:
git: https://github.com/capital-match/bytestring-trie.git
commit: 47526b2ec810239fe824c03c13cf1d81f0741b5c
extra-dep: true
resolver: nightly-2018-11-05
resolver: nightly-2018-12-19

extra-deps:
- finite-typelits-0.1.4.2
- vector-sized-1.0.4.0
- indexed-list-literals-0.2.1.2
- multiset-0.3.4.1
9 changes: 9 additions & 0 deletions webapi-contract/src/WebApi/Param.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Deserialization works analogously, 'FromParam' and 'DecodeParam' are counterpart
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE CPP #-}

module WebApi.Param
( -- * Serialization
ToParam (..)
Expand Down Expand Up @@ -141,7 +143,9 @@ import WebApi.Contract
import Data.Set (Set)
import qualified Data.Set as Set
import qualified Data.MultiSet as MultiSet
#if MIN_VERSION_vector(0,12,0)
import Data.Semigroup (Semigroup)
#endif

-- | A type for holding a file.
data FileInfo = FileInfo
Expand Down Expand Up @@ -180,7 +184,12 @@ instance FromJSON a => FromJSON (JsonOf a) where
parseJSON jval = JsonOf `fmap` parseJSON jval

newtype DelimitedCollection (delim :: Symbol) (t :: *) = DelimitedCollection {getCollection :: Vector t}
#if MIN_VERSION_vector(0,12,0)
deriving (Show, Read, Eq, Ord, FromJSON, ToJSON, Monad, Applicative, Functor, Foldable, Alternative, Monoid, Semigroup)
#else
deriving (Show, Read, Eq, Ord, FromJSON, ToJSON, Monad, Applicative, Functor, Foldable, Alternative, Monoid)
#endif



instance GHC.IsList (DelimitedCollection s a) where
Expand Down

0 comments on commit 5886eb3

Please sign in to comment.