packages feed

bizzlelude-js 1.0.4 → 4.17.2.2

raw patch · 9 files changed

+568/−120 lines, 9 filesdep +regexprdep ~basedep ~containersdep ~textsetup-changed

Dependencies added: regexpr

Dependency ranges changed: base, containers, text

Files

− Setup.hs
@@ -1,9 +0,0 @@-import Distribution.PackageDescription-import Distribution.Simple-import Distribution.Simple.LocalBuildInfo-import Distribution.Simple.Setup--import System.Process--main :: IO ()-main = defaultMain
bizzlelude-js.cabal view
@@ -1,15 +1,15 @@+Cabal-Version:       3.6 Name:                bizzlelude-js-Version:             1.0.4-Cabal-version:       >=1.22.0-License:             BSD3+Version:             4.17.2.2+License:             BSD-3-Clause License-File:        LICENSE.txt Author:              Jason Bertsche Maintainer:          jason.bertsche@gmail.com-Homepage:            http://github.com/TheBizzle+Homepage:            https://github.com/TheBizzle Category:            Prelude Synopsis:            A lousy Prelude replacement by a lousy dude-Description:         A lousy Prelude replacement by a lousy dude.  Imports common things while trying to avoid importing things could cause naming conflicts.  Favors `Text` over `String`.  Wants using `IO` to be painful.-Stability:           Experimental+Description:         A lousy Prelude replacement by a lousy dude.  Imports common things while trying to avoid importing things that could cause naming conflicts.  Favors `Text` over `String`.  Wants using `IO` to be painful.+Stability:           Stable Build-type:          Simple  source-repository head@@ -18,14 +18,259 @@  library   hs-source-dirs:   src/main-  exposed-modules:  Bizzlelude-  default-extensions: NoImplicitPrelude, OverloadedStrings+  exposed-modules:  Prelude+  default-extensions: OverloadedStrings   default-language: Haskell2010+  other-modules: External, Misc, Tuple2, Tuple3, Tuple4   GHC-Options:     -Wall+    -Wcompat+    -Wincomplete-record-updates+    -Wincomplete-uni-patterns+    -Wmissing-import-lists+    -Wredundant-constraints     -fno-warn-name-shadowing     -funbox-strict-fields   Build-depends:-    base       >= 4.8    && < 5,-    containers >= 0.5.7  && < 0.6.0,-    text       >= 1.2.2  && < 1.3.0+    , base == 4.17.2.1+    , containers     >= 0.6.7  && < 0.7.0+    , regexpr        >= 0.5.4  && < 0.6.0+    , text           >= 2.0.2  && < 2.1++  -- The below is copied from the `exposed-modules` in 'base' (modulo `prelude`)+  Reexported-Modules:+    , Control.Applicative+    , Control.Arrow+    , Control.Category+    , Control.Concurrent+    , Control.Concurrent.Chan+    , Control.Concurrent.MVar+    , Control.Concurrent.QSem+    , Control.Concurrent.QSemN+    , Control.Exception+    , Control.Exception.Base+    , Control.Monad+    , Control.Monad.Fail+    , Control.Monad.Fix+    , Control.Monad.Instances+    , Control.Monad.IO.Class+    , Control.Monad.ST+    , Control.Monad.ST.Lazy+    , Control.Monad.ST.Lazy.Safe+    , Control.Monad.ST.Lazy.Unsafe+    , Control.Monad.ST.Safe+    , Control.Monad.ST.Strict+    , Control.Monad.ST.Unsafe+    , Control.Monad.Zip+    , Data.Array.Byte+    , Data.Bifoldable+    , Data.Bifunctor+    , Data.Bitraversable+    , Data.Bits+    , Data.Bool+    , Data.Char+    , Data.Coerce+    , Data.Complex+    , Data.Data+    , Data.Dynamic+    , Data.Either+    , Data.Eq+    , Data.Fixed+    , Data.Foldable+    , Data.Function+    , Data.Functor+    , Data.Functor.Classes+    , Data.Functor.Contravariant+    , Data.Functor.Compose+    , Data.Functor.Const+    , Data.Functor.Identity+    , Data.Functor.Product+    , Data.Functor.Sum+    , Data.IORef+    , Data.Int+    , Data.Ix+    , Data.Kind+    , Data.List+    , Data.List.NonEmpty+    , Data.Maybe+    , Data.Monoid+    , Data.Ord+    , Data.Proxy+    , Data.Ratio+    , Data.Semigroup+    , Data.STRef+    , Data.STRef.Lazy+    , Data.STRef.Strict+    , Data.String+    , Data.Traversable+    , Data.Tuple+    , Data.Type.Bool+    , Data.Type.Coercion+    , Data.Type.Equality+    , Data.Type.Ord+    , Data.Typeable+    , Data.Unique+    , Data.Version+    , Data.Void+    , Data.Word+    , Debug.Trace+    , Foreign+    , Foreign.C+    , Foreign.C.Error+    , Foreign.C.String+    , Foreign.C.Types+    , Foreign.Concurrent+    , Foreign.ForeignPtr+    , Foreign.ForeignPtr.Safe+    , Foreign.ForeignPtr.Unsafe+    , Foreign.Marshal+    , Foreign.Marshal.Alloc+    , Foreign.Marshal.Array+    , Foreign.Marshal.Error+    , Foreign.Marshal.Pool+    , Foreign.Marshal.Safe+    , Foreign.Marshal.Unsafe+    , Foreign.Marshal.Utils+    , Foreign.Ptr+    , Foreign.Safe+    , Foreign.StablePtr+    , Foreign.Storable+    , GHC.Arr+    , GHC.ArrayArray+    , GHC.Base+    , GHC.Bits+    , GHC.ByteOrder+    , GHC.Char+    , GHC.Clock+    , GHC.Conc+    , GHC.Conc.IO+    , GHC.Conc.Signal+    , GHC.Conc.Sync+    , GHC.ConsoleHandler+    , GHC.Constants+    , GHC.Desugar+    , GHC.Enum+    , GHC.Environment+    , GHC.Err+    , GHC.Event.TimeOut+    , GHC.Exception+    , GHC.Exception.Type+    , GHC.ExecutionStack+    , GHC.ExecutionStack.Internal+    , GHC.Exts+    , GHC.Fingerprint+    , GHC.Fingerprint.Type+    , GHC.Float+    , GHC.Float.ConversionUtils+    , GHC.Float.RealFracMethods+    , GHC.Foreign+    , GHC.ForeignPtr+    , GHC.GHCi+    , GHC.GHCi.Helpers+    , GHC.Generics+    , GHC.IO+    , GHC.IO.Buffer+    , GHC.IO.BufferedIO+    , GHC.IO.Device+    , GHC.IO.Encoding+    , GHC.IO.Encoding.CodePage+    , GHC.IO.Encoding.Failure+    , GHC.IO.Encoding.Iconv+    , GHC.IO.Encoding.Latin1+    , GHC.IO.Encoding.Types+    , GHC.IO.Encoding.UTF16+    , GHC.IO.Encoding.UTF32+    , GHC.IO.Encoding.UTF8+    , GHC.IO.Exception+    , GHC.IO.FD+    , GHC.IO.Handle+    , GHC.IO.Handle.FD+    , GHC.IO.Handle.Internals+    , GHC.IO.Handle.Lock+    , GHC.IO.Handle.Text+    , GHC.IO.Handle.Types+    , GHC.IO.IOMode+    , GHC.IO.Unsafe+    , GHC.IO.StdHandles+    , GHC.IO.SubSystem+    , GHC.IOArray+    , GHC.IORef+    , GHC.Int+    , GHC.Integer+    , GHC.Integer.Logarithms+    , GHC.IsList+    , GHC.Ix+    , GHC.List+    , GHC.Maybe+    , GHC.MVar+    , GHC.Natural+    , GHC.Num+    , GHC.OldList+    , GHC.OverloadedLabels+    , GHC.Pack+    , GHC.Profiling+    , GHC.Ptr+    , GHC.Read+    , GHC.Real+    , GHC.Records+    , GHC.ResponseFile+    , GHC.RTS.Flags+    , GHC.ST+    , GHC.Stack.CloneStack+    , GHC.StaticPtr+    , GHC.STRef+    , GHC.Show+    , GHC.Stable+    , GHC.StableName+    , GHC.Stack+    , GHC.Stack.CCS+    , GHC.Stack.Types+    , GHC.Stats+    , GHC.Storable+    , GHC.TopHandler+    , GHC.TypeError+    , GHC.TypeLits+    , GHC.TypeLits.Internal+    , GHC.TypeNats+    , GHC.TypeNats.Internal+    , GHC.Unicode+    , GHC.Weak+    , GHC.Word+    , Numeric+    , Numeric.Natural+    , System.CPUTime+    , System.Console.GetOpt+    , System.Environment+    , System.Environment.Blank+    , System.Exit+    , System.IO+    , System.IO.Error+    , System.IO.Unsafe+    , System.Info+    , System.Mem+    , System.Mem.StableName+    , System.Mem.Weak+    , System.Posix.Internals+    , System.Posix.Types+    , System.Timeout+    , Text.ParserCombinators.ReadP+    , Text.ParserCombinators.ReadPrec+    , Text.Printf+    , Text.Read+    , Text.Read.Lex+    , Text.Show+    , Text.Show.Functions+    , Type.Reflection+    , Type.Reflection.Unsafe+    , Unsafe.Coerce+    , GHC.IOPort++  if os(windows)+    Reexported-Modules:+      , GHC.IO.Encoding.CodePage.API+      , GHC.IO.Encoding.CodePage.Table+      , GHC.Conc.Windows+      , GHC.Windows+  else+    Reexported-Modules:+      , GHC.Event
− src/main/Bizzlelude.hs
@@ -1,100 +0,0 @@-module Bizzlelude((|>), (<&>), asPath, asString, asText, concat, error, groupOn, map, putStrFlush, return', scalaGroupBy, showText, uncurry3, uncurry4, uncurry5, unsafeRead-                 , module Control.Arrow, module Control.Applicative, module Control.Monad, module Data.Bifunctor, module Data.Bool, module Data.Char, module Data.Either, module Data.Eq, module Data.Foldable, module Data.Function, module Data.Functor, module Data.Int, module Data.IntSet, module Data.Map, module Data.Maybe, module Data.Monoid, module Data.Set, module Data.Text, module Data.Tuple, module Debug.Trace, module Prelude, module Numeric, module System.IO.Error) where--import Control.Arrow((&&&), (***), (>>>))-import Control.Applicative(Alternative((<|>)), Applicative((<*>), (<*), (*>), pure))-import Control.Monad((>=>), filterM, foldM, foldM_, forM, forM_, guard, join, mapM, mapM_, Monad((>>), (>>=), return), MonadPlus(), sequence, sequence_, unless, when)--import Data.Bifunctor(Bifunctor(bimap, first, second))-import Data.Bool(Bool(False, True), (&&), (||), not, otherwise)-import Data.Char(Char, digitToInt, intToDigit)-import Data.Either(Either(Left, Right), either, lefts, isLeft, isRight, partitionEithers, rights)-import Data.Eq(Eq((==), (/=)))-import Data.Foldable(Foldable(fold, foldMap, foldr, foldr', foldl, foldl', foldr1, foldl1, null, length, elem, maximum, minimum, sum, product), foldlM, for_, sequenceA_, and, or, any, all, maximumBy, minimumBy, find)-import Data.Function(($), (.), const, flip, id, on)-import Data.Functor((<$), (<$>), ($>), Functor(fmap), void)-import Data.Int(Int, Int8, Int16, Int32, Int64)-import Data.IntSet(IntSet)-import Data.Map(Map)-import Data.Maybe(catMaybes, fromMaybe, isJust, isNothing, maybe, Maybe(Just, Nothing))-import Data.Monoid((<>), Monoid(mappend, mempty))-import Data.Ord(Ord((<), (<=), (>), (>=), compare, max, min), Ordering(EQ, GT, LT))-import Data.Set(Set)-import Data.Text(lines, Text, unlines, unwords, words)-import Data.Tuple(curry, fst, snd, swap, uncurry)--import Debug.Trace(trace, traceEvent, traceEventIO, traceId, traceIO, traceM, traceMarker, traceMarkerIO, traceShow, traceShowId, traceShowM, traceStack)--import Numeric(Floating, pi, exp, log, sqrt, (**), logBase, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh)--import Prelude((^), ($!), Double, FilePath, Float, Fractional((/), recip, fromRational), fromIntegral, Integral(quot, rem, div, mod, quotRem, divMod, toInteger), Integer, IO, Num((+), (-), (*), abs, signum, fromInteger, negate), read, RealFrac(properFraction, truncate, round, ceiling, floor), seq, Show(show), subtract, String, undefined)--import System.IO.Error(IOError, ioError, userError)--import qualified Prelude--import qualified Data.Either      as Either-import qualified Data.Foldable    as Foldable-import qualified Data.List        as List-import qualified Data.Text        as Text-import qualified Data.Text.IO     as TIO-import qualified Data.Text.Read   as DTR-import qualified System.IO        as SIO--(|>) :: a -> (a -> b) -> b-a |> f = f a--asString :: Text -> Prelude.String-asString = Text.unpack--asPath :: Text -> Prelude.FilePath-asPath = asString--asText :: Prelude.String -> Text-asText = Text.pack--showText :: Show a => a -> Text-showText = show >>> asText--concat :: (Foldable t, MonadPlus m) => t (m a) -> m a-concat = Foldable.msum--error :: Text -> a-error = asString >>> Prelude.error--map :: (Prelude.Functor f) => (a -> b) -> f a -> f b-map = Prelude.fmap--(<&>) :: Functor f => f a -> (a -> b) -> f b-(<&>) = flip map--groupOn :: Ord criterion => (item -> criterion) -> [item] -> [[item]]-groupOn f = sort >>> group-  where-    sort  = List.sortBy (compare `on` f)-    group = List.groupBy ((==) `on` f)--return' :: (Monad m) => a -> m a-return' = (return $!)--scalaGroupBy :: Ord criterion => (item -> criterion) -> [item] -> [(criterion, [item])]-scalaGroupBy f = (groupOn f) >>> pair-  where-    pair  = tee $ List.head >>> f-    tee f = map $ f &&& id---- Hack to make GHCI print this before the prompt (JAB, 2/20/17)-putStrFlush :: Text -> IO ()-putStrFlush x = (TIO.putStr x) >>= (const $ SIO.hFlush SIO.stdout)--unsafeRead :: Integral a => Text -> a-unsafeRead = DTR.decimal >>> (Either.either (error "Well, that read *was* unsafe...") id) >>> fst--uncurry3 :: (a -> b -> c -> d) -> ((a, b, c) -> d)-uncurry3 f (a, b, c) = f a b c--uncurry4 :: (a -> b -> c -> d -> e) -> ((a, b, c, d) -> e)-uncurry4 f (a, b, c, d) = f a b c d--uncurry5 :: (a -> b -> c -> d -> e -> f) -> ((a, b, c, d, e) -> f)-uncurry5 f (a, b, c, d, e) = f a b c d e
+ src/main/External.hs view
@@ -0,0 +1,45 @@+{-# LANGUAGE NoImplicitPrelude #-}+module External(module Control.Arrow, module Control.Applicative, module Control.Monad, module Control.Monad.IO.Class, module Data.Bifunctor, module Data.Bool, module Data.Char, module Data.Either, module Data.Eq, module Data.Foldable, module Data.Function, module Data.Functor, module Data.Int, module Data.IntSet, module Data.Map, module Data.Maybe, module Data.Monoid, module Data.Ord, module Data.Semigroup, module Data.Set, module Data.Text, module Data.Traversable, module Data.Tuple, module Debug.Trace, module GHC.Base, module GHC.Enum, module GHC.Err, module GHC.Float, module GHC.IO, module GHC.Num, module GHC.Real, module GHC.Show, module Numeric, module System.IO.Error, module Text.Read) where++import Control.Arrow((&&&), (***))+import Control.Applicative(Alternative((<|>)), Applicative((<*>), (<*), (*>), pure))+import Control.Monad((=<<), filterM, foldM, foldM_, forM, forM_, guard, join, mapM, mapM_, Monad((>>), (>>=), return), MonadPlus(), sequence, sequence_, unless, when)+import Control.Monad.IO.Class(liftIO)++import Data.Bifunctor(Bifunctor(bimap, first, second))+import Data.Bool(Bool(False, True), (&&), (||), not, otherwise)+import Data.Char(Char, digitToInt, intToDigit)+import Data.Either(Either(Left, Right), either, lefts, isLeft, isRight, partitionEithers, rights)+import Data.Eq(Eq((==), (/=)))+import Data.Foldable(Foldable(fold, foldMap, foldr, foldr', foldl, foldl', foldr1, foldl1, null, length, elem, maximum, minimum, sum, product), foldlM, for_, sequenceA_, and, or, any, all, maximumBy, minimumBy, find)+import Data.Function(($), (.), const, flip, id, on)+import Data.Functor((<$), (<$>), ($>), Functor(fmap), void)+import Data.Int(Int, Int8, Int16, Int32, Int64)+import Data.IntSet(IntSet)+import Data.Map(Map)+import Data.Maybe(catMaybes, fromMaybe, isJust, isNothing, listToMaybe, maybe, maybeToList, Maybe(Just, Nothing))+import Data.Monoid(Monoid(mappend, mempty))+import Data.Ord(Ord((<), (<=), (>), (>=), compare, max, min), Ordering(EQ, GT, LT))+import Data.Semigroup(Semigroup((<>)))+import Data.Set(Set)+import Data.Text(lines, Text, unlines, unwords, words)+import Data.Traversable(traverse)+import Data.Tuple(curry, fst, snd, swap, uncurry)++import Debug.Trace(trace, traceEvent, traceEventIO, traceId, traceIO, traceM, traceMarker, traceMarkerIO, traceShow, traceShowId, traceShowM, traceStack)++import GHC.Base(($!), seq, String)+import GHC.Enum(Bounded, boundedEnumFrom, boundedEnumFromThen, Enum, enumFrom, enumFromThen, enumFromThenTo, enumFromTo, fromEnum, fromEnumError, maxBound, minBound, pred, predError, succ, succError, toEnum, toEnumError)++import GHC.Err(undefined)+import GHC.Float(Double, Float)+import GHC.IO(FilePath, IO)+import GHC.Num(Integer, Num((+), (-), (*), abs, signum, fromInteger, negate), subtract)+import GHC.Real((^), (^^), Fractional((/), recip, fromRational), fromIntegral, Integral(quot, rem, div, mod, quotRem, divMod, toInteger), RealFrac(properFraction, truncate, round, ceiling, floor), Real(toRational))+import GHC.Show(Show(show))++import Numeric(Floating, pi, exp, log, sqrt, (**), logBase, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh)++import System.IO.Error(IOError, ioError, userError)++import Text.Read(read)
+ src/main/Misc.hs view
@@ -0,0 +1,94 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}+module Misc((|>), (&>), (&>=), (>>>), (>=>), asString, asPath, asText, showText, concat, error, fromEither, map, pam, (<&>), cartProduct, regexMatch, groupOn, return', scalaGroupBy, putStrFlush, traceLabel, unsafeRead, uncurry5) where++import External++import Text.RegexPR(matchRegexPR)++import qualified Control.Arrow    as CArrow+import qualified Control.Monad    as CMonad+import qualified Data.Either      as Either+import qualified Data.Foldable    as Foldable+import qualified Data.List        as List+import qualified Data.Text        as Text+import qualified Data.Text.IO     as TIO+import qualified Data.Text.Read   as DTR+import qualified GHC.Err          as Err+import qualified System.IO        as SIO++(|>) :: a -> (a -> b) -> b+a |> f = f a++(&>), (>>>) :: (a -> b) -> (b -> c) -> (a -> c)+(>>>) = (CArrow.>>>)+(&>)  = (>>>)++(&>=), (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)+(>=>) = (CMonad.>=>)+(&>=) = (>=>)++infixl 2 >>>, >=>+infixl 1 |>++asString :: Text -> String+asString = Text.unpack++asPath :: Text -> FilePath+asPath = asString++asText :: String -> Text+asText = Text.pack++showText :: Show a => a -> Text+showText = show &> asText++concat :: (Foldable t, MonadPlus m) => t (m a) -> m a+concat = Foldable.msum++error :: Text -> a+error = asString &> Err.error++map :: (Functor f) => (a -> b) -> f a -> f b+map = fmap++pam, (<&>) :: Functor f => f a -> (a -> b) -> f b+pam   = flip map+(<&>) = flip map++cartProduct :: [a] -> [b] -> [(a, b)]+cartProduct xs ys = [(x, y) | x <- xs, y <- ys]++regexMatch :: Text -> Text -> Maybe [Text]+regexMatch regex = asString &> (matchRegexPR $ asString regex) &> (map $ snd &> (map $ snd &> asText))++fromEither :: Either a a -> a+fromEither = either id id++groupOn :: Ord criterion => (item -> criterion) -> [item] -> [[item]]+groupOn f = sort &> group+  where+    sort  = List.sortBy (compare `on` f)+    group = List.groupBy ((==) `on` f)++return' :: (Monad m) => a -> m a+return' = (return $!)++scalaGroupBy :: Ord criterion => (item -> criterion) -> [item] -> [(criterion, [item])]+scalaGroupBy f = (groupOn f) &> pair+  where+    pair  = tee $ List.head &> f+    tee f = map $ f &&& id++-- Hack to make GHCI print this before the prompt (JAB, 2/20/17)+putStrFlush :: Text -> IO ()+putStrFlush x = (TIO.putStr x) >>= (const $ SIO.hFlush SIO.stdout)++traceLabel :: (Show a) => Text -> a -> a+traceLabel label a = traceShow (label <> ": " <> (showText a)) a++unsafeRead :: Integral a => Text -> a+unsafeRead = DTR.decimal &> (Either.either (error "Well, that read *was* unsafe...") id) &> fst++uncurry5 :: (a -> b -> c -> d -> e -> f) -> ((a, b, c, d, e) -> f)+uncurry5 f (a, b, c, d, e) = f a b c d e
+ src/main/Prelude.hs view
@@ -0,0 +1,8 @@+{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}+module Prelude(module External, module Misc, module Tuple2, module Tuple3, module Tuple4) where++import External+import Misc+import Tuple2+import Tuple3+import Tuple4
+ src/main/Tuple2.hs view
@@ -0,0 +1,35 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}+module Tuple2(mapFst, mapSnd, mapAll2, mapEach2, mapFstF, mapSndF, tuple2To3a, tuple2To3b, tuple2To3c) where++import External++(<&>) :: Functor f => f a -> (a -> b) -> f b+(<&>) = flip fmap++mapFst :: (a -> x) -> (a, b) -> (x, b)+mapFst f (a, b) = (f a, b)++mapSnd :: (b -> x) -> (a, b) -> (a, x)+mapSnd f (a, b) = (a, f b)++mapAll2 :: (a -> x) -> (a, a) -> (x, x)+mapAll2 f (a, b) = (f a, f b)++mapEach2 :: (a -> x) -> (b -> y) -> (a, b) -> (x, y)+mapEach2 f g (a, b) = (f a, g b)++mapFstF :: Functor f => (a -> f x) -> (a, b) -> f (x, b)+mapFstF f (a, b) = (f a) <&> (\x -> (x, b))++mapSndF :: Functor f => (b -> f x) -> (a, b) -> f (a, x)+mapSndF f (a, b) = (f b) <&> (\x -> (a, x))++tuple2To3a :: (a, b) -> x -> (x, a, b)+tuple2To3a (a, b) x = (x, a, b)++tuple2To3b :: (a, b) -> x -> (a, x, b)+tuple2To3b (a, b) x = (a, x, b)++tuple2To3c :: (a, b) -> x -> (a, b, x)+tuple2To3c (a, b) x = (a, b, x)
+ src/main/Tuple3.hs view
@@ -0,0 +1,59 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}+module Tuple3(mapFst3, mapSnd3, mapThd3, mapAll3, mapEach3, mapFstF3, mapSndF3, mapThdF3, tuple3To4a, tuple3To4b, tuple3To4c, tuple3To4d, curry3, uncurry3, fst3, snd3, thd3) where++import External++(<&>) :: Functor f => f a -> (a -> b) -> f b+(<&>) = flip fmap++mapFst3 :: (a -> x) -> (a, b, c) -> (x, b, c)+mapFst3 f (a, b, c) = (f a, b, c)++mapSnd3 :: (b -> x) -> (a, b, c) -> (a, x, c)+mapSnd3 f (a, b, c) = (a, f b, c)++mapThd3 :: (c -> x) -> (a, b, c) -> (a, b, x)+mapThd3 f (a, b, c) = (a, b, f c)++mapAll3 :: (a -> x) -> (a, a, a) -> (x, x, x)+mapAll3 f (a, b, c) = (f a, f b, f c)++mapEach3 :: (a -> x) -> (b -> y) -> (c -> z) -> (a, b, c) -> (x, y, z)+mapEach3 f g h (a, b, c) = (f a, g b, h c)++mapFstF3 :: Functor f => (a -> f x) -> (a, b, c) -> f (x, b, c)+mapFstF3 f (a, b, c) = (f a) <&> (\x -> (x, b, c))++mapSndF3 :: Functor f => (b -> f x) -> (a, b, c) -> f (a, x, c)+mapSndF3 f (a, b, c) = (f b) <&> (\x -> (a, x, c))++mapThdF3 :: Functor f => (c -> f x) -> (a, b, c) -> f (a, b, x)+mapThdF3 f (a, b, c) = (f c) <&> (\x -> (a, b, x))++tuple3To4a :: (a, b, c) -> x -> (x, a, b, c)+tuple3To4a (a, b, c) x = (x, a, b, c)++tuple3To4b :: (a, b, c) -> x -> (a, x, b, c)+tuple3To4b (a, b, c) x = (a, x, b, c)++tuple3To4c :: (a, b, c) -> x -> (a, b, x, c)+tuple3To4c (a, b, c) x = (a, b, x, c)++tuple3To4d :: (a, b, c) -> x -> (a, b, c, x)+tuple3To4d (a, b, c) x = (a, b, c, x)++curry3 :: ((a, b, c) -> x) -> a -> b -> c -> x+curry3 f a b c = f (a, b, c)++uncurry3 :: (a -> b -> c -> x) -> ((a, b, c) -> x)+uncurry3 f (a, b, c) = f a b c++fst3 :: (a, b, c) -> a+fst3 (a, _, _) = a++snd3 :: (a, b, c) -> b+snd3 (_, b, _) = b++thd3 :: (a, b, c) -> c+thd3 (_, _, c) = c
+ src/main/Tuple4.hs view
@@ -0,0 +1,71 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}+module Tuple4(mapFst4, mapSnd4, mapThd4, mapFrt4, mapAll4, mapEach4, mapFstF4, mapSndF4, mapThdF4, mapFrtF4, tuple4To5a, tuple4To5b, tuple4To5c, tuple4To5d, tuple4To5e, curry4, uncurry4, fst4, snd4, thd4, frt4) where++import External++(<&>) :: Functor f => f a -> (a -> b) -> f b+(<&>) = flip fmap++mapFst4 :: (a -> x) -> (a, b, c, d) -> (x, b, c, d)+mapFst4 f (a, b, c, d) = (f a, b, c, d)++mapSnd4 :: (b -> x) -> (a, b, c, d) -> (a, x, c, d)+mapSnd4 f (a, b, c, d) = (a, f b, c, d)++mapThd4 :: (c -> x) -> (a, b, c, d) -> (a, b, x, d)+mapThd4 f (a, b, c, d) = (a, b, f c, d)++mapFrt4 :: (d -> x) -> (a, b, c, d) -> (a, b, c, x)+mapFrt4 f (a, b, c, d) = (a, b, c, f d)++mapAll4 :: (a -> x) -> (a, a, a, a) -> (x, x, x, x)+mapAll4 f (a, b, c, d) = (f a, f b, f c, f d)++mapEach4 :: (a -> x) -> (b -> y) -> (c -> z) -> (d -> l) -> (a, b, c, d) -> (x, y, z, l)+mapEach4 f g h i (a, b, c, d) = (f a, g b, h c, i d)++mapFstF4 :: Functor f => (a -> f x) -> (a, b, c, d) -> f (x, b, c, d)+mapFstF4 f (a, b, c, d) = (f a) <&> (\x -> (x, b, c, d))++mapSndF4 :: Functor f => (b -> f x) -> (a, b, c, d) -> f (a, x, c, d)+mapSndF4 f (a, b, c, d) = (f b) <&> (\x -> (a, x, c, d))++mapThdF4 :: Functor f => (c -> f x) -> (a, b, c, d) -> f (a, b, x, d)+mapThdF4 f (a, b, c, d) = (f c) <&> (\x -> (a, b, x, d))++mapFrtF4 :: Functor f => (d -> f x) -> (a, b, c, d) -> f (a, b, c, x)+mapFrtF4 f (a, b, c, d) = (f d) <&> (\x -> (a, b, c, x))++tuple4To5a :: (a, b, c, d) -> x -> (x, a, b, c, d)+tuple4To5a (a, b, c, d) x = (x, a, b, c, d)++tuple4To5b :: (a, b, c, d) -> x -> (a, x, b, c, d)+tuple4To5b (a, b, c, d) x = (a, x, b, c, d)++tuple4To5c :: (a, b, c, d) -> x -> (a, b, x, c, d)+tuple4To5c (a, b, c, d) x = (a, b, x, c, d)++tuple4To5d :: (a, b, c, d) -> x -> (a, b, c, x, d)+tuple4To5d (a, b, c, d) x = (a, b, c, x, d)++tuple4To5e :: (a, b, c, d) -> x -> (a, b, c, d, x)+tuple4To5e (a, b, c, d) x = (a, b, c, d, x)++curry4 :: ((a, b, c, d) -> x) -> a -> b -> c -> d -> x+curry4 f a b c d = f (a, b, c, d)++uncurry4 :: (a -> b -> c -> d -> x) -> ((a, b, c, d) -> x)+uncurry4 f (a, b, c, d) = f a b c d++fst4 :: (a, b, c, d) -> a+fst4 (a, _, _, _) = a++snd4 :: (a, b, c, d) -> b+snd4 (_, b, _, _) = b++thd4 :: (a, b, c, d) -> c+thd4 (_, _, c, _) = c++frt4 :: (a, b, c, d) -> d+frt4 (_, _, _, d) = d