git.iko.soy/typeable/servant
on master help sign in
Merge pull request #511 from phadej/remove-servant-cassava

Remove servant-cassava, moved to own repository

commit461d43693df406132e327fbfaa5468aa635016f9 authorJulian Arni <jkarni@gmail.com> dateFri 13 May 2016, 12:43 (10 years ago) parentea366565a3b944
10 files changed−193
servant-cassava/LICENSE−30 servant-cassava/Setup.hs−2 servant-cassava/include/overlapping-compat.h−8 servant-cassava/servant-cassava.cabal−31 servant-cassava/src/Servant/CSV/Cassava.hs−115 servant-cassava/tinc.yaml−3 sources.txt−1 stack-ghc-7.8.4.yaml−1 stack-ghc-8.0.1.yaml−1 stack.yaml−1
servant-cassava/LICENSEdeleted−30
@@ -1,30 +0,0 @@
1−Copyright (c) 2015-2016, Servant Contributors
2−
3−All rights reserved.
4−
5−Redistribution and use in source and binary forms, with or without
6−modification, are permitted provided that the following conditions are met:
7−
8− * Redistributions of source code must retain the above copyright
9− notice, this list of conditions and the following disclaimer.
10−
11− * Redistributions in binary form must reproduce the above
12− copyright notice, this list of conditions and the following
13− disclaimer in the documentation and/or other materials provided
14− with the distribution.
15−
16− * Neither the name of Julian K. Arni nor the names of other
17− contributors may be used to endorse or promote products derived
18− from this software without specific prior written permission.
19−
20−THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21−"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22−LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23−A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24−OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25−SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26−LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27−DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28−THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29−(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30−OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
servant-cassava/Setup.hsdeleted−2
@@ -1,2 +0,0 @@
1−import Distribution.Simple
2−main = defaultMain
servant-cassava/include/overlapping-compat.hdeleted−8
@@ -1,8 +0,0 @@
1−#if __GLASGOW_HASKELL__ >= 710
2−#define OVERLAPPABLE_ {-# OVERLAPPABLE #-}
3−#define OVERLAPPING_ {-# OVERLAPPING #-}
4−#else
5−{-# LANGUAGE OverlappingInstances #-}
6−#define OVERLAPPABLE_
7−#define OVERLAPPING_
8−#endif
servant-cassava/servant-cassava.cabaldeleted−31
@@ -1,31 +0,0 @@
1−-- Initial servant-cassava.cabal generated by cabal init. For further
2−-- documentation, see http://haskell.org/cabal/users-guide/
3−
4−name: servant-cassava
5−version: 0.7.1
6−synopsis: Servant CSV content-type for cassava
7−-- description:
8−homepage: http://haskell-servant.readthedocs.org/
9−license: BSD3
10−license-file: LICENSE
11−author: Servant Contributors
12−maintainer: haskell-servant-maintainers@googlegroups.com
13−copyright: 2015-2016 Servant Contributors
14−-- category:
15−build-type: Simple
16−extra-source-files: include/*.h
17−cabal-version: >=1.10
18−
19−library
20− exposed-modules: Servant.CSV.Cassava
21− -- other-modules:
22− -- other-extensions:
23− build-depends: base >=4.6 && <5
24− , cassava >0.4 && <0.5
25− , servant == 0.7.*
26− , http-media
27− , vector
28− hs-source-dirs: src
29− default-language: Haskell2010
30− include-dirs: include
31− ghc-options: -Wall
servant-cassava/src/Servant/CSV/Cassava.hsdeleted−115
@@ -1,115 +0,0 @@
1−{-# LANGUAGE CPP #-}
2−{-# LANGUAGE DeriveDataTypeable #-}
3−{-# LANGUAGE DeriveGeneric #-}
4−{-# LANGUAGE FlexibleInstances #-}
5−{-# LANGUAGE MultiParamTypeClasses #-}
6−{-# LANGUAGE OverloadedStrings #-}
7−{-# LANGUAGE ScopedTypeVariables #-}
8−
9−-- | A @CSV@ empty datatype with `MimeRender` and `MimeUnrender` instances for
10−-- @cassava@'s encoding and decoding classes.
11−--
12−-- >>> type Eg = Get '[(CSV', MyEncodeOptions)] [(Int, String)]
13−--
14−-- Default encoding and decoding options are also provided, along with the
15−-- @CSV@ type synonym that uses them.
16−--
17−-- >>> type EgDefault = Get '[CSV] [(Int, String)]
18−module Servant.CSV.Cassava where
19−
20−#if !MIN_VERSION_base(4,8,0)
21−import Control.Applicative ((<$>))
22−#endif
23−import Data.Csv
24−import Data.Proxy (Proxy (..))
25−import Data.Typeable (Typeable)
26−import Data.Vector (Vector, toList)
27−import GHC.Generics (Generic)
28−import qualified Network.HTTP.Media as M
29−import Servant.API (Accept (..), MimeRender (..),
30− MimeUnrender (..))
31−
32−data CSV' deriving (Typeable, Generic)
33−
34−type CSV = (CSV', DefaultDecodeOpts)
35−
36−-- | @text/csv;charset=utf-8@
37−instance Accept (CSV', a) where
38− contentType _ = "text" M.// "csv" M./: ("charset", "utf-8")
39−
40−-- * Encoding
41−
42−-- ** Instances
43−
44−-- | Encode with 'encodeByNameWith'. The 'Header' param is used for determining
45−-- the order of headers and fields.
46−instance ( ToNamedRecord a, EncodeOpts opt
47− ) => MimeRender (CSV', opt) (Header, [a]) where
48− mimeRender _ (hdr, vals) = encodeByNameWith (encodeOpts p) hdr vals
49− where p = Proxy :: Proxy opt
50−
51−-- | Encode with 'encodeDefaultOrderedByNameWith'
52−instance ( DefaultOrdered a, ToNamedRecord a, EncodeOpts opt
53− ) => MimeRender (CSV', opt) [a] where
54− mimeRender _ = encodeDefaultOrderedByNameWith (encodeOpts p)
55− where p = Proxy :: Proxy opt
56−
57−-- | Encode with 'encodeByNameWith'. The 'Header' param is used for determining
58−-- the order of headers and fields.
59−instance ( ToNamedRecord a, EncodeOpts opt
60− ) => MimeRender (CSV', opt) (Header, Vector a) where
61− mimeRender _ (hdr, vals) = encodeByNameWith (encodeOpts p) hdr (toList vals)
62− where p = Proxy :: Proxy opt
63−
64−-- | Encode with 'encodeDefaultOrderedByNameWith'
65−instance ( DefaultOrdered a, ToNamedRecord a, EncodeOpts opt
66− ) => MimeRender (CSV', opt) (Vector a) where
67− mimeRender _ = encodeDefaultOrderedByNameWith (encodeOpts p) . toList
68− where p = Proxy :: Proxy opt
69−
70−-- ** Encode Options
71−
72−class EncodeOpts a where
73− encodeOpts :: Proxy a -> EncodeOptions
74−
75−data DefaultEncodeOpts deriving (Typeable, Generic)
76−
77−instance EncodeOpts DefaultEncodeOpts where
78− encodeOpts _ = defaultEncodeOptions
79−
80−-- * Decoding
81−
82−-- ** Instances
83−
84−-- | Decode with 'decodeByNameWith'
85−instance ( FromNamedRecord a, DecodeOpts opt
86− ) => MimeUnrender (CSV', opt) (Header, [a]) where
87− mimeUnrender _ bs = fmap toList <$> decodeByNameWith (decodeOpts p) bs
88− where p = Proxy :: Proxy opt
89−
90−-- | Decode with 'decodeWith'. Assumes data has headers, which are stripped.
91−instance ( FromRecord a, DecodeOpts opt
92− ) => MimeUnrender (CSV', opt) [a] where
93− mimeUnrender _ bs = toList <$> decodeWith (decodeOpts p) HasHeader bs
94− where p = Proxy :: Proxy opt
95−
96−instance ( FromNamedRecord a, DecodeOpts opt
97− ) => MimeUnrender (CSV', opt) (Header, Vector a) where
98− mimeUnrender _ = decodeByNameWith (decodeOpts p)
99− where p = Proxy :: Proxy opt
100−
101−-- | Decode with 'decodeWith'. Assumes data has headers, which are stripped.
102−instance ( FromRecord a, DecodeOpts opt
103− ) => MimeUnrender (CSV', opt) (Vector a) where
104− mimeUnrender _ = decodeWith (decodeOpts p) HasHeader
105− where p = Proxy :: Proxy opt
106−
107−-- ** Decode Options
108−
109−class DecodeOpts a where
110− decodeOpts :: Proxy a -> DecodeOptions
111−
112−data DefaultDecodeOpts deriving (Typeable, Generic)
113−
114−instance DecodeOpts DefaultDecodeOpts where
115− decodeOpts _ = defaultDecodeOptions
servant-cassava/tinc.yamldeleted−3
@@ -1,3 +0,0 @@
1−dependencies:
2− - name: servant
3− path: ../servant
sources.txt−1
@@ -1,7 +1,6 @@
11servant
22servant-server
33servant-client
4−servant-cassava
54servant-docs
65servant-foreign
76servant-js
stack-ghc-7.8.4.yaml−1
@@ -2,7 +2,6 @@ flags: {}
22packages:
33- servant/
44- servant-blaze/
5−- servant-cassava/
65- servant-client/
76- servant-docs/
87- servant-foreign/
stack-ghc-8.0.1.yaml−1
@@ -4,7 +4,6 @@ flags:
44packages:
55- servant/
66- servant-blaze/
7−- servant-cassava/
87- servant-client/
98- servant-docs/
109- servant-foreign/
stack.yaml−1
@@ -4,7 +4,6 @@ flags:
44packages:
55- servant/
66- servant-blaze/
7−- servant-cassava/
87- servant-client/
98- servant-docs/
109- servant-foreign/