packages feed

semigroupoids-syntax (empty) → 0.0.1

raw patch · 11 files changed

+529/−0 lines, 11 filesdep +QuickCheckdep +basedep +comonadbuild-type:Customsetup-changed

Dependencies added: QuickCheck, base, comonad, containers, contravariant, directory, distributive, doctest, filepath, semigroupoids, semigroups, template-haskell, transformers

Files

+ LICENSE view
@@ -0,0 +1,27 @@+Copyright 2014 NICTA Limited++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:+1. Redistributions of source code must retain the above copyright+   notice, this list of conditions and the following disclaimer.+2. 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.+3. Neither the name of the author nor the names of his contributors+   may be used to endorse or promote products derived from this software+   without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 AUTHORS 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.lhs view
@@ -0,0 +1,44 @@+#!/usr/bin/env runhaskell+\begin{code}+{-# OPTIONS_GHC -Wall #-}+module Main (main) where++import Data.List ( nub )+import Data.Version ( showVersion )+import Distribution.Package ( PackageName(PackageName), PackageId, InstalledPackageId, packageVersion, packageName )+import Distribution.PackageDescription ( PackageDescription(), TestSuite(..) )+import Distribution.Simple ( defaultMainWithHooks, UserHooks(..), simpleUserHooks )+import Distribution.Simple.Utils ( rewriteFile, createDirectoryIfMissingVerbose )+import Distribution.Simple.BuildPaths ( autogenModulesDir )+import Distribution.Simple.Setup ( BuildFlags(buildVerbosity), fromFlag )+import Distribution.Simple.LocalBuildInfo ( withLibLBI, withTestLBI, LocalBuildInfo(), ComponentLocalBuildInfo(componentPackageDeps) )+import Distribution.Verbosity ( Verbosity )+import System.FilePath ( (</>) )++main :: IO ()+main = defaultMainWithHooks simpleUserHooks+  { buildHook = \pkg lbi hooks flags -> do+     generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi+     buildHook simpleUserHooks pkg lbi hooks flags+  }++generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()+generateBuildModule verbosity pkg lbi = do+  let dir = autogenModulesDir lbi+  createDirectoryIfMissingVerbose verbosity True dir+  withLibLBI pkg lbi $ \_ libcfg -> do+    withTestLBI pkg lbi $ \suite suitecfg -> do+      rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines+        [ "module Build_" ++ testName suite ++ " where"+        , "deps :: [String]"+        , "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg))+        ]+  where+    formatdeps = map (formatone . snd)+    formatone p = case packageName p of+      PackageName n -> n ++ "-" ++ showVersion (packageVersion p)++testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)]+testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys++\end{code}
+ changelog view
@@ -0,0 +1,4 @@+0.0.1++Initial release+
+ semigroupoids-syntax.cabal view
@@ -0,0 +1,132 @@+name:               semigroupoids-syntax+version:            0.0.1+license:            BSD3+license-file:       LICENSE+author:             Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> <dibblego>+maintainer:         Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> <dibblego>+copyright:          Copyright (C) 2014 NICTA Limited+synopsis:           RebindableSyntax using the semigroupoids package+category:           Data+description:        +  <<http://i.imgur.com/Ns5hntl.jpg>>+  .+  RebindableSyntax using the semigroupoids package+homepage:           https://github.com/NICTA/semigroupoids-syntax+bug-reports:        https://github.com/NICTA/semigroupoids-syntax/issues+cabal-version:      >= 1.10+build-type:         Custom+extra-source-files: changelog++source-repository   head+  type:             git+  location:         git@github.com:NICTA/semigroupoids-syntax.git++flag                small_base+  description:      Choose the new, split-up base package.++flag containers+  description:+    You can disable the use of the `containers` package using `-f-containers`.+    .+    Disabing this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users.+  default: True+  manual: True++flag contravariant+  description:+    You can disable the use of the `contravariant` package using `-f-contravariant`.+    .+    Disabling this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users.+    .+    If disabled we will not supply instances of `Contravariant`+    .+  default: True+  manual: True++flag distributive+  description:+    You can disable the use of the `distributive` package using `-f-distributive`.+    .+    Disabling this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users.+    .+    If disabled we will not supply instances of `Distributive`+    .+  default: True+  manual: True++flag comonad+  description:+    You can disable the use of the `comonad` package using `-f-comonad`.+    .+    Disabling this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users.+    .+    If disabled we will not supply instances of `Comonad`+    .+  default: True+  manual: True++library+  default-language:+                    Haskell2010++  build-depends:+                      base < 5 && >= 3+                    , semigroups    >= 0.8.3.1 && < 1+                    , transformers  >= 0.2     && < 0.6+                    , semigroupoids == 4.2++  if flag(containers)+    build-depends: containers >= 0.3 && < 0.6++  if flag(contravariant)+    build-depends: contravariant >= 0.2.0.1 && < 2++  if flag(distributive)+    build-depends: distributive >= 0.2.2 && < 1++  if flag(comonad)+    build-depends: comonad      >= 4     && < 5++  ghc-options:+                    -Wall++  default-extensions:+                    NoImplicitPrelude+                    RebindableSyntax++  hs-source-dirs:+                    src++  exposed-modules:+                    Data.Functor.All.Syntax+                    Data.Functor.Apply.Syntax+                    Data.Functor.Bind.Syntax+                    Data.Functor.Point+                    Data.Functor.Point.Syntax+                    Data.Functor.Syntax++test-suite doctests+  type:+                    exitcode-stdio-1.0++  main-is:+                    doctests.hs++  default-language:+                    Haskell2010++  build-depends:+                      base < 5 && >= 3+                    , doctest >= 0.9.7+                    , filepath >= 1.3+                    , directory >= 1.1+                    , QuickCheck >= 2.0+                    , template-haskell >= 2.8++  ghc-options:+                    -Wall+                    -threaded++  hs-source-dirs:+                    test+
+ src/Data/Functor/All/Syntax.hs view
@@ -0,0 +1,38 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE RebindableSyntax #-}+{-# LANGUAGE Safe #-}++module Data.Functor.All.Syntax(+  fail+, fromInteger+, ifThenElse+) where++import qualified Control.Monad as M(Monad(fail))+import qualified Data.Bool as B(Bool(True, False))+import qualified Data.String as S(String)+import qualified Prelude as P(Num, Integer, fromInteger)++fail ::+  M.Monad m =>+  S.String+  -> m a+fail =+  M.fail++fromInteger ::+  P.Num a =>+  P.Integer+  -> a+fromInteger =+  P.fromInteger++ifThenElse ::+  B.Bool+  -> a+  -> a+  -> a+ifThenElse B.True t _ =+  t+ifThenElse B.False _ f =+  f
+ src/Data/Functor/Apply/Syntax.hs view
@@ -0,0 +1,19 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE RebindableSyntax #-}+{-# LANGUAGE Safe #-}++module Data.Functor.Apply.Syntax(+  (>>)+) where++import Data.Functor.Apply(Apply((.>)))++(>>) ::+  Apply f =>+  f a+  -> f b+  -> f b+(>>) =+  (.>)++infixl 1 >>
+ src/Data/Functor/Bind/Syntax.hs view
@@ -0,0 +1,19 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE RebindableSyntax #-}+{-# LANGUAGE Safe #-}++module Data.Functor.Bind.Syntax(+  (>>=)+) where++import Data.Functor.Bind(Bind((>>-)))++(>>=) ::+  Bind f =>+  f a+  -> (a -> f b)+  -> f b+(>>=) =+  (>>-)++infixl 1 >>=
+ src/Data/Functor/Point.hs view
@@ -0,0 +1,185 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE RebindableSyntax #-}+{-# LANGUAGE Safe #-}++module Data.Functor.Point(+  Point(point) +) where++import Control.Applicative(Applicative(pure), ZipList, Const, WrappedMonad, WrappedArrow)+import Control.Arrow(Arrow)+import Control.Comonad(Cokleisli)+import Control.Comonad.Trans.Env(EnvT(EnvT))+import Control.Comonad.Trans.Identity(IdentityT)+import Control.Comonad.Trans.Store(StoreT)+import Control.Comonad.Trans.Traced(TracedT)+import Control.Monad(Monad)+import Control.Monad.Trans.Cont(ContT)+import Control.Monad.Trans.List(ListT)+import Control.Monad.Trans.Maybe(MaybeT)+import Control.Monad.Trans.Reader(ReaderT)+import Control.Monad.Trans.RWS.Lazy as RWSL(RWST)+import Control.Monad.Trans.RWS.Strict as RWSS(RWST)+import Control.Monad.Trans.State.Lazy as LS(StateT)+import Control.Monad.Trans.State.Strict as SS(StateT)+import Control.Monad.Trans.Writer.Lazy as LW(WriterT)+import Control.Monad.Trans.Writer.Strict as SW(WriterT)+import Data.Either(Either)+import Data.Functor.Apply(Apply, MaybeApply, WrappedApplicative)+import Data.Functor.Bind(Bind)+import Data.Functor.Compose(Compose)+import Data.Functor.Identity(Identity)+import Data.Functor.Product(Product)+import Data.List.NonEmpty(NonEmpty)+import Data.Maybe(Maybe)+import Data.Monoid(Monoid(mempty))+import Data.Semigroup(Semigroup, Option)+import Data.Semigroupoid.Static(Static)+import Data.Sequence(Seq)+import Data.Tree(Tree)+import System.IO(IO)++class Apply f => Point f where+  point ::+    a+    -> f a++instance Point [] where+  point =+    pure++instance Point IO where+  point =+    pure++instance Point ZipList where+  point =+    pure++instance Point Maybe where+  point =+    pure++instance Point Identity where+  point =+    pure++instance Point Tree where+  point =+    pure++instance Point Seq where+  point =+    pure++instance Point Option where+  point =+    pure++instance Point NonEmpty where+  point =+    pure++instance Point ((->) m) where+  point =+    pure++instance Point (Either a) where+  point =+    pure++instance (Semigroup m, Monoid m) => Point ((,) m) where+  point =+    pure++instance (Semigroup m, Monoid m) => Point (Const m) where+  point =+    pure++instance Monad f => Point (WrappedMonad f) where+  point =+    pure++instance (Apply f, Applicative f) => Point (IdentityT f) where+  point =+    pure++instance (Bind f, Monad f) => Point (MaybeT f) where+  point =+    pure++instance (Apply f, Applicative f) => Point (ListT f) where+  point =+    pure++instance Point f => Point (MaybeApply f) where+  point =+    pure++instance (Apply f, Applicative f) => Point (WrappedApplicative f) where+  point =+    pure++instance Arrow a => Point (WrappedArrow a b) where+  point =+    pure++instance (Apply f, Applicative f) => Point (TracedT t f) where+  point =+    pure++instance (Apply f, Applicative f, Semigroup m, Monoid m) => Point (StoreT m f) where+  point =+    pure++instance (Apply f, Applicative f, Semigroup m, Monoid m) => Point (EnvT m f) where+  point a =+    EnvT mempty (pure a) ++instance Point (Cokleisli f a) where+  point =+    pure++instance (Applicative f, Apply f, Applicative g, Apply g) => Point (Product f g) where+  point =+    pure++instance (Applicative f, Apply f, Applicative g, Apply g) => Point (Compose f g) where+  point =+    pure++instance (Applicative f, Apply f, Semigroup w, Monoid w) => Point (SW.WriterT w f) where+  point =+    pure++instance (Applicative f, Apply f, Semigroup w, Monoid w) => Point (LW.WriterT w f) where+  point =+    pure++instance (Bind f, Monad f) => Point (SS.StateT e f) where+  point =+    pure++instance (Bind f, Monad f) => Point (LS.StateT e f) where+  point =+    pure++instance (Applicative f, Apply f) => Point (ReaderT r f) where+  point =+    pure++instance Point (ContT r f) where+  point =+    pure++instance (Apply f, Applicative f) => Point (Static f a) where+  point =+    pure++instance (Bind f, Monad f, Semigroup w, Monoid w) => Point (RWSS.RWST r w s f) where+  point =+    pure++instance (Bind f, Monad f, Semigroup w, Monoid w) => Point (RWSL.RWST r w s f) where+  point =+    pure
+ src/Data/Functor/Point/Syntax.hs view
@@ -0,0 +1,16 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE RebindableSyntax #-}+{-# LANGUAGE Safe #-}++module Data.Functor.Point.Syntax(+  return+) where++import Data.Functor.Point(Point(point))++return ::+  Point f =>+  a+  -> f a+return =+  point
+ src/Data/Functor/Syntax.hs view
@@ -0,0 +1,13 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE RebindableSyntax #-}+{-# LANGUAGE Safe #-}++module Data.Functor.Syntax(+  module S+) where++import Data.Functor.All.Syntax as S+import Data.Functor.Apply.Syntax as S+import Data.Functor.Bind.Syntax as S+import Data.Functor.Point as S+import Data.Functor.Point.Syntax as S
+ test/doctests.hs view
@@ -0,0 +1,32 @@+module Main where++import Build_doctests (deps)+import Control.Applicative+import Control.Monad+import Data.List+import System.Directory+import System.FilePath+import Test.DocTest++main ::+  IO ()+main =+  getSources >>= \sources -> doctest $+      "-isrc"+    : "-idist/build/autogen"+    : "-optP-include"+    : "-optPdist/build/autogen/cabal_macros.h"+    : "-hide-all-packages"+    : map ("-package="++) deps ++ sources++getSources :: IO [FilePath]+getSources = filter (isSuffixOf ".hs") <$> go "src"+  where+    go dir = do+      (dirs, files) <- getFilesAndDirectories dir+      (files ++) . concat <$> mapM go dirs++getFilesAndDirectories :: FilePath -> IO ([FilePath], [FilePath])+getFilesAndDirectories dir = do+  c <- map (dir </>) . filter (`notElem` ["..", "."]) <$> getDirectoryContents dir+  (,) <$> filterM doesDirectoryExist c <*> filterM doesFileExist c