packages feed

ClassyPrelude (empty) → 0.1

raw patch · 5 files changed

+143/−0 lines, 5 filesdep +basedep +strictsetup-changed

Dependencies added: base, strict

Files

+ ClassyPrelude.cabal view
@@ -0,0 +1,23 @@+Name:                ClassyPrelude+Version:             0.1+Synopsis:            Prelude replacement using classes instead of concrete types where reasonable+Description:         ClassyPrelude is a Prelude for people who know Haskell well. It+                     re-exports some commonly imported modules, replaces Prelude+                     functions with their type-class equivalents where reasonable, and+                     removes some Prelude functions that in my opinion don't belong+                     there.++                     These modules are likely to be incomplete. Suggestions are greatly appreciated.+License:             BSD3+License-file:        LICENSE+Author:              Svein Ove Aas+Maintainer:          sveina@gmail.com+Category:            Control, Data+Build-type:          Simple+Cabal-version:       >=1.2+Stability:           Experimental++Library+  Build-Depends:     base >= 4 && < 5, strict >= 0.3.2+  Extensions:        NoImplicitPrelude+  Exposed-modules:   Prelude.Classy, Prelude.Math
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c)2010, Svein Ove Aas++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 Svein Ove Aas 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.
+ Prelude/Classy.hs view
@@ -0,0 +1,73 @@+-- | Prelude replacement, use the NoImplicitPrelude extension before importing this.+--+-- It deliberately omits all list-handling functions, import Data.List or use the generic versions.+module Prelude.Classy(+  -- * Basic/legacy types+  module Data.Bool,+  bool,+  module Data.Maybe,+  module Data.Either,+  module Data.Eq,+  module Data.Ord,+  Enum(..),+  Char, String(..), fst, snd, lines, words, unlines, unwords, Show(..), Read(..), read,+  -- * Basic I/O+  IO, putChar, putStr, putStrLn, print, getChar, getLine, readFile, writeFile, appendFile,+  readIO, readLn,+  -- * Basic function composition+  curry, uncurry, first, second, id, const, (.), flip, ($), until,+  -- * Integer math+  Int, Integer, Bounded(..), Num(..), Integral(..),+  subtract, even, odd, (^), fromIntegral,+  -- * Monad hierarchy+  module Control.Applicative,+  module Control.Monad,+  -- * Monoids, Foldables and other goodies+  module Data.Monoid, (<>),+  module Data.Foldable,+  module Data.Traversable,+  -- * Misc.+  asTypeOf, error, undefined, seq, ($!)+  ) where++import Data.Bool+import Data.Maybe+import Data.Either+import Data.Ord+import Data.Eq+import Prelude(Char,String(..),fst,snd,curry,uncurry,Bounded(..), Num(..),+               Integral(..), Enum(..), lines, words, unlines, unwords, Show(..),+               Read(..), read, IO, putChar, putStr, putStrLn, print, getChar, writeFile,+               appendFile, readIO, readLn, getLine, id, const, (.), flip, until,+               asTypeOf, error, undefined, seq, subtract, even, odd, (^), fromIntegral, Int, Integer)+import Control.Arrow(first,second)+import Control.Applicative+import Control.Monad hiding(mapM, mapM_, sequence, sequence_, forM, forM_, msum)+import Data.Monoid+import Data.Foldable+import Data.Traversable+import System.IO.Strict(readFile)++-- | An either/maybe equivalent for Bool, often known as if'+bool :: a -- ^ Returned if the bool is True+        -> a -- ^ Returned if the bool is False+        -> Bool +        -> a+bool a _ True  = a+bool _ a False = a++infixr 5 <>++-- | (<>) = mappend+a <> b = mappend a b++filter :: (Monad m, Monoid (m a), Foldable t) => (a -> Bool) -> t a -> m a+filter p = foldMap (\a -> bool (return a) mempty (p a))++infixl 0 $, $!++-- | *Left-associative* version of Prelude.$+f $ x = f x++-- | *Left-associative* version of Prelude.$!+f $! x = x `seq` f x
+ Prelude/Math.hs view
@@ -0,0 +1,15 @@+-- | Prelude.Classy, plus some mathematical/floating-point functions+module Prelude.Math(+  module Prelude.Classy,+  -- * Mathematical functions+  gcd, lcm,+  -- * Fixed/floating-point math+  module Data.Ratio,+  Float, Double, Fractional(..), Floating(..), RealFrac(..), RealFloat(..),+  (^^), realToFrac+  ) where++import Prelude(Fractional(..), Floating(..), RealFrac(..), RealFloat(..), (^^),+               Float, Double, gcd, lcm, realToFrac)+import Prelude.Classy+import Data.Ratio
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain