packages feed

acme-kitchen-sink (empty) → 0.1.0.0

raw patch · 8 files changed

+318/−0 lines, 8 filesdep +basesetup-changed

Dependencies added: base

Files

+ ChangeLog.md view
@@ -0,0 +1,7 @@+# Revision history for acme-kitchen-sink++## 0.1.0.0  -- 2017-02-21++	* Open issue #1: Reverse of fmap "lifting" behavior+	* Open issue #2: Monoid generalization of Alternative generators+	* Open issue #3: Category Monoids
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2017, Marcos Dumay de Medeiros++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * 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.++    * Neither the name of Marcos Dumay de Medeiros nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT+OWNER 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.
+ README.md view
@@ -0,0 +1,129 @@+Do you have code you feel that should be shared on some library, but+can't pin down on how it should be named, or structured? Are you+reusing tools that you are uncertain if optimal, or even if they solve+the right problem? Does everything seem in place, aligned, within+reach, and yet you just can't grab that bird?++If so, this package is for you.++# acme-kitchen-sink++A place for dumping that does-not-feel-right code while you talk about it and+make it good enough for somewhere else.++Our SLA provides at a minimum an unlimited supply of rubber ducks¹ to+help² you settle your open issues.++## Contributing++Every piece of code must be related to an open issue, with its number+pointed by at the code documentation comments.++The library must compile at all times.++Code should preferentially have names that do not conflict with well+used libraries, so people can better play with and evaluate it. When+unsure, feel free to add `Acme` modules at any namespace.++Try to keep extensions restricted to modules and non-conflicting.++This library is compiled with -Wall e -Wwarn-incomplete-patterns. Feel+free to disable warnings in modules when necessary. Just don't let+them spill into the terminal.++If you are in doubt if your code is good enough for this package, it+is. Open your issues and send a PR.++## Usage++Really??++The best practices manual for using this library follows:++> Don't.+>+> If you really insist, refrain from it.++Although copying and pasting code from here into your project *may* be+safe. Do it carefully. And tell about it on the respective issues and+subscribe to them.++What more can I say? In fact, I can say a lot!++Nobody ever got fired³ by choosing `acme-kitchen-sink`.++If deployment is necessary, `acme-catapult` may be an invaluable tool+for achieving very deterministic outcomes. If `acme-catapult` turns+out to be too restrictive for your needs, the Acme Jet Propulsion Lab+will gladly provide a series of products that will grant all the+needed flexibility for your kitchen-sink deployment procedures, just+make sure to be physically present at every stage.++Anyway, whatever deployment method is chosen, make sure to account for+the low latency and high responsivity of the deployment target. Also+ensure you have a direct path connecting you to the target, as there+have been many reports of problems with unreliable tunnels and+unexpected traffic surges within them.++You too can join the club of happy acme-kitchen-sink users. See what+some of our most famous users have to say about it and get a feel for+the kind of experiences acme-kitchen-sink can bring for you:++> "Acme-kitchen-sync feels like home! The overall architecture, the+> long reaching conventions, the enforced structure, the unity of+> design, the well thought-out decisions. Everything in it reminds my+> favorite programming environment."+>+> -- Proud PHP Programmer++---++>  "It was about time that lazy compiler started to give me *options*!+>  I'm used to tools that relentless look for ways to help me, and+>  keep me informed of all necessary details. Only after I imported+>  acme-kitchen-sink I started getting my usual amount of error+>  tracing information at compile time. I'll tell you - I don't miss+>  templates anymore."+>+> -- Converted C++ Coder++---++> "Out there on the road, there are no safe places, no retreats, no+> margin for error. Out there you'll suffer on every unpatched hole,+> every virtual construction will turn against you, you will+> eventually hit every boulder on your way, or it will hit you!+>+> It's a dog-eat-bird world out there, and on those situations you+> need nothing but *predictability*. That's why I use Acme, and the+> kitchen-sink didn't bring any less of it - it gets exactly the same+> quality of results I've grown to expect from any other Acme tool, no+> more, no less; no disappointments, no surprises.+>+> I can only say one thing about `acme-kitchen-sink`: __Would use again!__"+>  +> -- Willie C. - Certified Acme Product Deployer Expert (APDE)++----++## Is this Serious?++Well, yes, just not too serious.++I do think there is a need for a space for sharing uncertain code and+talking about it. This package provides it.++## Small Print++1 - May contain rubber.++2 - A duck insanity surcharge applies for any rubber duck gone mad in+consequence of high level Math sorcery.++3 - Acme declines any responsibility from semantic confusion emanating+from the similarity of that word with "burned", "smashed", "exploded",+"electrocuted" or "dropped out of a cliff". Acme also declines any+responsibility from iconic confusion by the similarity of the+previously mentioned icon and "fired at", that although sharing many+visual properties must not replace the above single standing,+prepositionless adjective.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ acme-kitchen-sink.cabal view
@@ -0,0 +1,52 @@+-- Initial acme-kitchen-sink.cabal generated by cabal init.  For further +-- documentation, see http://haskell.org/cabal/users-guide/++name:                acme-kitchen-sink+version:             0.1.0.0+synopsis:            A place for dumping that does-not-feel-right code while you improve it+description:+            Do you have code you feel that should be shared on some library, but+            can't pin down on how it should be named, or structured? Are you+            reusing tools that you are uncertain if optimal, or even if they solve+            the right problem? Does everything seem in place, aligned, within+            reach, and yeat you just can't grab that bird?+            .+            If so, this package is for you.+            .+            Drop here any code you think may be valuable, and refrain from depending+            on this package. If anything here is useful for you, copy into your+            project and subscribe to the respective issue.+            .+            See the README for more details.++homepage:            https://github.com/marcosdumay/acme-kitchen-sink+license:             BSD3+license-file:        LICENSE+author:              Marcos Dumay de Medeiros+maintainer:          marcos@marcosdumay.com+category:            Other+build-type:          Simple+extra-source-files:  ChangeLog.md, README.md+cabal-version:       >=1.10++source-repository head+  type:     git+  location: https://github.com/marcosdumay/acme-kitchen-sink.git+  branch:   master++source-repository this+  type:     git+  location: https://github.com/marcosdumay/acme-kitchen-sink.git+  tag:   0.1.0.0++library+  exposed-modules:+                  Control.Applicative.Acme,+                  Data.Monoid.Acme,+                  Data.Monoid.Category+  -- other-modules:       +  -- other-extensions:    +  build-depends:       base >=4.9 && <4.10+  hs-source-dirs:      src+  default-language:    Haskell2010+  ghc-options: -Wall -fwarn-incomplete-patterns
+ src/Control/Applicative/Acme.hs view
@@ -0,0 +1,17 @@+module Control.Applicative.Acme where++{- |+Application with the inverse lifting behavior of fmap.++Issue #1+-}+pamf :: Applicative f => f (a -> b) -> a -> f b+pamf f a = f <*> pure a++{- |+Operator version of pamf++Issue #1+-}+(>$<) :: Applicative f => f (a -> b) -> a -> f b+(>$<) = pamf
+ src/Data/Monoid/Acme.hs view
@@ -0,0 +1,48 @@+module Data.Monoid.Acme where+++import Control.Applicative++{- |+Many generalization for Monoid instances.++Issue #2+-}+mmany :: (Alternative a, Monoid m) => a m -> a m+mmany f = foldl mappend mempty <$> many f++{- |+Some generatlization for Monoid instances.++Issue #2+-}+msome :: (Alternative a, Monoid m) => a m -> a m+msome f = foldl mappend mempty <$> some f++{- |+Utility for casting bare values into a Monoid in mmany.++For example, the function:++>  let sumMany = manyWith Sum getSum++will sum the results of many.++Issue #2+-}+manyWith :: (Alternative a, Monoid m) => (v -> m) -> (m -> v) -> a v -> a v+manyWith toMonoid fromMonoid f = fromMonoid <$> (mmany $ toMonoid <$> f)++{- |+Utility for casting bare values into a Monoid in msome.++For example, the function:++> let sumSome = someWith Sum getSum++will sum the results of some.++Issue #2+-}+someWith :: (Alternative a, Monoid m) => (v -> m) -> (m -> v) -> a v -> a v+someWith toMonoid fromMonoid f = fromMonoid <$> (msome $ toMonoid <$> f)
+ src/Data/Monoid/Category.hs view
@@ -0,0 +1,33 @@+{-# LANGUAGE FlexibleInstances #-}++{- |+Monoids on category composition.++Issue #3+-}+module Data.Monoid.Category where++import qualified Control.Category as Cat+import Data.Monoid.Acme+import Control.Applicative++-- | Monoid on category composition (>>>)+newtype Composition c = Composition {getComposition :: c}+instance Cat.Category c => Monoid (Composition (c a a)) where+  mempty = Composition Cat.id+  mappend (Composition a) (Composition b) = Composition $ a Cat.>>> b+++-- | Monoid on reverse category composition (<<<)+newtype RevComposition c = RevComposition {getRevComposition :: c}+instance Cat.Category c => Monoid (RevComposition (c a a)) where+  mempty = RevComposition Cat.id+  mappend (RevComposition a) (RevComposition b) = RevComposition $ a Cat.<<< b++-- | Alternatives accumulator @many@ for Composition+composeMany :: (Alternative m, Cat.Category cat) => m (cat a a) -> m (cat a a)+composeMany = manyWith Composition getComposition++-- | Alternatives accumulator @many@ for RevComposition+invComposeMany :: (Alternative m, Cat.Category cat) => m (cat a a) -> m (cat a a)+invComposeMany = manyWith RevComposition getRevComposition