packages feed

relit (empty) → 0.1.0

raw patch · 4 files changed

+103/−0 lines, 4 filesdep +basedep +regex-basedep +template-haskellsetup-changed

Dependencies added: base, regex-base, template-haskell

Files

+ LICENSE view
@@ -0,0 +1,29 @@+Copyright (c) 2009, IIJ Innovation Institute Inc.+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:++  * Redistributions of source code must retain the above copyright+    notice, this list of conditions and the following disclaimer.+  * Redistributions in binary form must reproduce the above copyright+    notice, this list of conditions and the following disclaimer in+    the documentation and/or other materials provided with the+    distribution.+  * Neither the name of the copyright holders nor the names of its+    contributors may be used to endorse or promote products derived+    from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ Text/Regex/Literal.hs view
@@ -0,0 +1,51 @@+{-# LANGUAGE FlexibleContexts, FlexibleInstances, UndecidableInstances #-}+{-# OPTIONS -fno-warn-orphans #-}++{-|+  Literal notation for regular expression.++  Importing this module with the 'QuasiQuotes' and 'OverloadedStrings'+  extensions making possible to directly specify reqular expression+  literal. This means that awkward backslashes are not necessary.++  Sample code:++>    { -# LANGUAGE QuasiQuotes, OverloadedStrings #- }+>    -- Due to Haddock limitation, spaces are inserted after and before "}".+>    -- Remove them if you copy this.+>+>    import Text.Regex.Literal+>    import Text.Regex.Posix+>+>    -- Regular expression as the String literal+>    -- regexp :: Regex+>    -- regexp = makeRegex ("\\\\(foo)\\\\(bar\\.c)" :: String)+>    +>    -- Regular expression as the regular expression literal+>    regexp :: Regex+>    regexp = [$re|\\(foo)\\(bar\.c)|]+-}+module Text.Regex.Literal (re) where++import Data.String+import Language.Haskell.TH+import Language.Haskell.TH.Quote+import Text.Regex.Base++{-|+  A 'QuasiQuoter' function to implement regular expression literal.+-}+re :: QuasiQuoter+re = QuasiQuoter parseExprExp parseExprPat++parseExprExp :: String -> ExpQ+parseExprExp x = return . LitE . StringL $ x++parseExprPat :: String -> PatQ+parseExprPat = undefined++instance (RegexMaker regex compOpt execOpt String) => IsString regex where+  fromString s = make s+    where+      make :: (RegexMaker regex compOpt execOpt String) => String -> regex+      make = makeRegex
+ relit.cabal view
@@ -0,0 +1,21 @@+Name:                   relit+Version:                0.1.0+Author:                 Kazu Yamamoto <kazu@iij.ad.jp>+Maintainer:             Kazu Yamamoto <kazu@iij.ad.jp>+License:                BSD3+License-File:           LICENSE+Synopsis:               Literal for regular expression+Description:            Literal notation for regular expression with QuasiQuotes+Category:               Text+Cabal-Version:          >= 1.6+Build-Type:             Simple+library+  if impl(ghc >= 6.12)+    GHC-Options:        -Wall -fno-warn-unused-do-bind+  else+    GHC-Options:        -Wall+  Exposed-Modules:      Text.Regex.Literal+  Build-Depends:        base >= 4 && < 5, regex-base, template-haskell+Source-Repository head+  Type:                 git+  Location:             git://github.com/kazu-yamamoto/relit.git