commit 02015ca5e3deda44fc5297352a60575d70ac4109 Author: Nikita Volkov Date: Sun Aug 3 17:48:18 2014 +0400 Init diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e5c0294 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: haskell + +ghc: + - 7.6 + - 7.8 + +install: + - cabal install happy # a "haskell-src-exts" implicit dependency workaround + - cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fe32f2b --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2014, 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. diff --git a/high-sql.cabal b/high-sql.cabal new file mode 100644 index 0000000..f6ca1f4 --- /dev/null +++ b/high-sql.cabal @@ -0,0 +1,55 @@ +name: + high-sql +version: + 0.1.0 +synopsis: +description: +category: +homepage: + https://github.com/nikita-volkov/high-sql +bug-reports: + https://github.com/nikita-volkov/high-sql/issues +author: + Nikita Volkov +maintainer: + Nikita Volkov +copyright: + (c) 2014, 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/high-sql.git + + +library + hs-source-dirs: + library + other-modules: + HighSQL.Prelude + exposed-modules: + HighSQL + HighSQL.Backend + build-depends: + -- database: + ex-pool == 0.2.*, + -- errors: + loch-th == 0.2.*, + placeholders == 0.1.*, + -- general: + mtl-prelude == 0.1.*, + base-prelude == 0.1.* + 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 diff --git a/library/HighSQL.hs b/library/HighSQL.hs new file mode 100644 index 0000000..6c235db --- /dev/null +++ b/library/HighSQL.hs @@ -0,0 +1,18 @@ +module HighSQL where + +import HighSQL.Prelude hiding (read, Read, write, Write) +import qualified HighSQL.Backend as Backend +import qualified Data.Pool as Pool + + +-- | +-- A session, in which transactions are executed. +-- It maintains the shared state between transactions. +type S = + ReaderT (Pool.Pool Backend.Connection) + +-- | +-- Run the session monad transformer in the base monad. +session :: Backend.Backend -> S m r -> m r +session b s = + $notImplemented diff --git a/library/HighSQL/Backend.hs b/library/HighSQL/Backend.hs new file mode 100644 index 0000000..9bbf62d --- /dev/null +++ b/library/HighSQL/Backend.hs @@ -0,0 +1,10 @@ +-- | +-- An open API for implementation of specific drivers. +module HighSQL.Backend where + +import HighSQL.Prelude + + +data Backend + +data Connection diff --git a/library/HighSQL/Prelude.hs b/library/HighSQL/Prelude.hs new file mode 100644 index 0000000..dd3af2d --- /dev/null +++ b/library/HighSQL/Prelude.hs @@ -0,0 +1,31 @@ +module HighSQL.Prelude +( + module Exports, + bug, + bottom, +) +where + + +-- base-prelude +------------------------- +import BasePrelude as Exports + +-- mtl-prelude +------------------------- +import MTLPrelude as Exports hiding (shift) + +-- placeholders +------------------------- +import Development.Placeholders as Exports + +-- custom +------------------------- +import qualified Debug.Trace.LocationTH + + +bug = [e| $(Debug.Trace.LocationTH.failure) . (msg <>) |] + where + msg = "A \"stream\" package bug: " :: String + +bottom = [e| $bug "Bottom evaluated" |]