record-preprocessor 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+36/−17 lines, 2 filesdep ~base-preludedep ~basic-lensdep ~record
Dependency ranges changed: base-prelude, basic-lens, record, record-syntax
Files
- demo/Main.hs +16/−3
- record-preprocessor.cabal +20/−14
demo/Main.hs view
@@ -1,19 +1,32 @@ module Main where -import BasePrelude import Control.Lens.Basic +-- Uses the Strict Record syntax. type Person =- {! name :: String, birthday :: {! year :: Int, month :: Int, day :: Int } }+ {! + name :: String, + birthday :: {! year :: Int, month :: Int, day :: Int }, + country :: Country+ } +-- Uses the Lazy Record syntax.+type Country =+ {~+ name :: String,+ language :: String+ }++person :: Person person = {! name = "Yuri Alekseyevich Gagarin", birthday = {! year = 1934, month = 3, day = 9 },- country = {! name = "Soviet Union", language = "Russian" }+ country = {~ name = "Soviet Union", language = "Russian" } } +-- Uses the Field-label Lens syntax. main = do putStrLn $ "Name: " <> show (view @name person) putStrLn $ "Country: " <> show (view (@country . @name) person)
record-preprocessor.cabal view
@@ -1,9 +1,18 @@ name: record-preprocessor version:- 0.1.0.0+ 0.1.0.1 synopsis: Compiler preprocessor introducing a syntactic extension for anonymous records+description:+ This package provides an executable "record-preprocessor",+ which can be used as a compilation phase to add support for+ the Anynonymous Records syntax.+ .+ To get a look at what syntax the preprocessor enables check out+ <http://hackage.haskell.org/package/record-preprocessor-0.1.0.1/src/demo/Main.hs the demo> and+ <http://hackage.haskell.org/package/record-preprocessor-0.1.0.1/src/record-preprocessor.cabal its configuration in the Cabal file>,+ which are both bundled with this package. category: Preprocessor, Compiler, Records homepage:@@ -68,21 +77,18 @@ 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,+ -- A required dependency on a library of record-types:+ record == 0.4.*,+ -- An optional dependency on the basic subset of the "lens" library:+ basic-lens == 0.0.*+ ghc-options:+ -- The following options enable the compiler-preprocessor+ -- for the whole project. -- - basic-lens,- base-prelude-+ -- For this to work you need to manually execute "cabal install record-preprocessor" and+ -- make sure that your Cabal "bin" installation folder is on "PATH".+ -F -pgmF record-preprocessor