packages feed

record-preprocessor (empty) → 0.1.0.0

raw patch · 5 files changed

+163/−0 lines, 5 filesdep +basedep +base-preludedep +basic-lenssetup-changed

Dependencies added: base, base-prelude, basic-lens, conversion, conversion-text, record, record-syntax, text

Files

+ LICENSE view
@@ -0,0 +1,22 @@+Copyright (c) 2015, Nikita Volkov++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.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ demo/Main.hs view
@@ -0,0 +1,22 @@+module Main where++import BasePrelude+import Control.Lens.Basic+++type Person =+  {! name :: String, birthday :: {! year :: Int, month :: Int, day :: Int } }++person =+  {! +    name = "Yuri Alekseyevich Gagarin", +    birthday = {! year = 1934, month = 3, day = 9 },+    country = {! name = "Soviet Union", language = "Russian" }+  }++main = do+  putStrLn $ "Name: " <> show (view @name person)+  putStrLn $ "Country: " <> show (view (@country . @name) person)+++
+ preprocessor/Main.hs view
@@ -0,0 +1,29 @@+module Main where++import BasePrelude+import System.IO+import Conversion+import Conversion.Text+import Record.Syntax+import qualified Data.Text.IO as Text+import qualified Data.Text.Lazy.IO as LazyText+++main =+  do+    [sourcePath, inputPath, outputPath] <- getArgs+    inHandle <- openFile inputPath ReadMode+    outHandle <- openFile outputPath WriteMode++    Text.hGetContents inHandle >>= return . processModule >>= \case+      Left x -> do+        hPutStrLn stderr $ formatError x+        hFlush outHandle+        exitWith $ ExitFailure 1+      Right x -> do+        LazyText.hPutStrLn outHandle $ convert $ x+        hFlush outHandle+        exitWith $ ExitSuccess+  where+    formatError ((line, column), message) =+      "Error at " <> show line <> ":" <> show column <> ": " <> message
+ record-preprocessor.cabal view
@@ -0,0 +1,88 @@+name:+  record-preprocessor+version:+  0.1.0.0+synopsis:+  Compiler preprocessor introducing a syntactic extension for anonymous records+category:+  Preprocessor, Compiler, Records+homepage:+  https://github.com/nikita-volkov/record-preprocessor +bug-reports:+  https://github.com/nikita-volkov/record-preprocessor/issues +author:+  Nikita Volkov <nikita.y.volkov@mail.ru>+maintainer:+  Nikita Volkov <nikita.y.volkov@mail.ru>+copyright:+  (c) 2015, Nikita Volkov+license:+  MIT+license-file:+  LICENSE+build-type:+  Simple+cabal-version:+  >=1.10+++source-repository head+  type:+    git+  location:+    git://github.com/nikita-volkov/record-preprocessor.git+++executable record-preprocessor+  hs-source-dirs:+    preprocessor+  main-is:+    Main.hs+  ghc-options:+    -O2+    -threaded+    "-with-rtsopts=-N"+  default-extensions:+    Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, ImpredicativeTypes, LambdaCase, LiberalTypeSynonyms, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators+  default-language:+    Haskell2010+  build-depends:+    -- +    record-syntax == 0.1.*,+    -- +    conversion == 1.*,+    conversion-text == 1.*,+    text == 1.*,+    -- +    base-prelude == 0.1.*,+    base == 4.*+++-- Well, it's not a benchmark actually, +-- but in Cabal there's no better way to specify an executable, +-- which is not intended for distribution.+benchmark demo+  type: +    exitcode-stdio-1.0+  hs-source-dirs:+    demo+  main-is:+    Main.hs+  ghc-options:+    -O2+    -threaded+    "-with-rtsopts=-N"+    -F -pgmF dist/build/record-preprocessor/record-preprocessor+  default-extensions:+    Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, ImpredicativeTypes, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples+  default-language:+    Haskell2010+  build-depends:+    -- +    record,+    record-syntax,+    -- +    basic-lens,+    base-prelude++