Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-volkov committed Jan 17, 2015
0 parents commit 1020625
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 0 deletions.
22 changes: 22 additions & 0 deletions LICENSE
@@ -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.
19 changes: 19 additions & 0 deletions library/Record.hs
@@ -0,0 +1,19 @@
module Record where

import BasePrelude
import Language.Haskell.TH
import Language.Haskell.TH.Quote
import qualified Record.Field


record :: QuasiQuoter
record =
QuasiQuoter
(const $ fail "Expression context is not supported")
(const $ fail "Pattern context is not supported")
(const $ fail "Type context is not supported")
(const $ fail "Declaration context is not supported")

lens :: QuasiQuoter
lens =
undefined
17 changes: 17 additions & 0 deletions library/Record/Field.hs
@@ -0,0 +1,17 @@
module Record.Field where

import BasePrelude
import GHC.TypeLits
import Record.Lens (Lens)


newtype Field (n :: Symbol) a = Field a

class Owner n a where
type Value n a
setField :: Proxy n -> Value n a -> a -> a
getField :: Proxy n -> a -> Value n a

lens :: Owner n a => Proxy n -> Lens a (Value n a)
lens n =
\f a -> fmap (\v -> setField n v a) (f (getField n a))
13 changes: 13 additions & 0 deletions library/Record/Lens.hs
@@ -0,0 +1,13 @@
-- |
-- A minimal subset of the "lens" functionality,
-- which is completely compatible with it.
module Record.Lens where

import BasePrelude


type Lens s a =
forall f. Functor f => (a -> f a) -> (s -> f s)



55 changes: 55 additions & 0 deletions record.cabal
@@ -0,0 +1,55 @@
name:
record
version:
0.1.0
synopsis:
description:
category:
Control, Data Structures
homepage:
https://github.com/nikita-volkov/record
bug-reports:
https://github.com/nikita-volkov/record/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.git


library
hs-source-dirs:
library
ghc-options:
-funbox-strict-fields
default-extensions:
Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFunctor, DeriveGeneric, 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
other-modules:
exposed-modules:
Record.Field
Record.Lens
Record
build-depends:
--
template-haskell,
--
base-prelude >= 0.1 && < 0.2,
base >= 4.6 && < 4.9

0 comments on commit 1020625

Please sign in to comment.