packages feed

portable-template-haskell-lens (empty) → 0.1.0.0

raw patch · 5 files changed

+117/−0 lines, 5 filesdep +basedep +lensdep +template-haskellsetup-changed

Dependencies added: base, lens, template-haskell

Files

+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2016 Simon Hudon++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ README.md view
@@ -0,0 +1,7 @@+# portable-template-haskell-lens++OS X / Linux: [![Build Status](https://travis-ci.org/literate-unitb/portable-template-haskell-lens.svg?branch=master)](https://travis-ci.org/literate-unitb/portable-template-haskell-lens)++Windows: [![Build status](https://ci.appveyor.com/api/projects/status/5fdp6hhub89v1y3p?svg=true)](https://ci.appveyor.com/project/cipher1024/portable-template-haskell-lens)++Template Haskell 2.11 changes its constructors. In order to write portable code, this package provides lenses / prisms to work across versions of template haskell
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ portable-template-haskell-lens.cabal view
@@ -0,0 +1,70 @@+-- Initial portable-template-haskell-lens.cabal generated by cabal init.  +-- For further documentation, see http://haskell.org/cabal/users-guide/++-- The name of the package.+name:                portable-template-haskell-lens++-- The package version.  See the Haskell package versioning policy (PVP) +-- for standards guiding when and how versions should be incremented.+-- http://www.haskell.org/haskellwiki/Package_versioning_policy+-- PVP summary:      +-+------- breaking API changes+--                   | | +----- non-breaking API additions+--                   | | | +--- code changes with no API change+version:             0.1.0.0++-- A short (one-line) description of the package.+synopsis:            Lenses for the AST of Template Haskell 2.11 and Template Haskell < 2.11++-- A longer description of the package.+description:         Template Haskell 2.11 changes its constructors. In order to write portable code, this package provides lenses / prisms to work across versions of template haskell++-- The license under which the package is released.+license:             MIT++-- The file containing the license text.+license-file:        LICENSE++-- The package author(s).+author:              Simon Hudon++-- An email address to which users can send suggestions, bug reports, and +-- patches.+maintainer:          simon.hudon@gmail.com++-- A copyright notice.+-- copyright:           ++category:            Language++build-type:          Simple++-- Extra files to be distributed with the package, such as examples or a +-- README.+extra-source-files:  README.md++-- Constraint on the version of Cabal needed to build this package.+cabal-version:       >=1.10++source-repository head+  type:     git+  location: https://github.com/literate-unitb/portable-template-haskell-lens++library+  -- Modules exported by the library.+  exposed-modules:     Language.Haskell.TH.Lens.Portable+  +  -- Modules included in this library but not exported.+  -- other-modules:       +  +  -- LANGUAGE extensions used by modules in this package.+  -- other-extensions:    +  +  -- Other library packages from which modules are imported.+  build-depends:       base >=4.8 && <5, template-haskell, lens+  +  -- Directories containing source files.+  hs-source-dirs:      src+  +  -- Base language which the package is written in.+  default-language:    Haskell2010+  
+ src/Language/Haskell/TH/Lens/Portable.hs view
@@ -0,0 +1,18 @@+{-# LANGUAGE CPP #-}+module Language.Haskell.TH.Lens.Portable where++import Control.Lens+import Language.Haskell.TH++_InstanceD' :: Prism' Dec (Cxt, Type, [Dec])+_InstanceD' = prism' reviewer remitter+  where+#if MIN_VERSION_template_haskell(2,11,0)+      reviewer (x, y, z) = InstanceD Nothing x y z+      remitter (InstanceD _ x y z) = Just (x, y, z)+#else+      reviewer (x, y, z) = InstanceD x y z+      remitter (InstanceD x y z) = Just (x, y, z)+#endif+      remitter _ = Nothing+