packages feed

prolude (empty) → 0.0.0.0

raw patch · 10 files changed

+489/−0 lines, 10 filesdep +aesondep +basedep +bytestring

Dependencies added: aeson, base, bytestring, mongoDB, safe-exceptions, scientific, text, time, vector

Files

+ LICENSE.txt view
@@ -0,0 +1,19 @@+Copyright (c) 2020 EdutainmentLIVE, LLC++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.
+ Prolude.hs view
@@ -0,0 +1,18 @@+module Prolude+  ( module Prolude.Aeson+  , module Prolude.Core+  , module Prolude.Exception+  , module Prolude.Json+  , module Prolude.MongoDB+  , module Prolude.Text+  , module Prolude.Time+  )+where++import Prolude.Aeson+import Prolude.Core+import Prolude.Exception+import Prolude.Json+import Prolude.MongoDB+import Prolude.Text+import Prolude.Time
+ Prolude/Aeson.hs view
@@ -0,0 +1,62 @@+{-# LANGUAGE PatternSynonyms #-}++module Prolude.Aeson+  ( module Data.Aeson+  , JsonOptions+  , JsonValue+  , pattern JsonArray+  , pattern JsonBoolean+  , pattern JsonNull+  , pattern JsonNumber+  , pattern JsonObject+  , pattern JsonString+  )+where++import Data.Aeson+  ( FromJSON+  , ToJSON+  , fromJSON+  , genericParseJSON+  , genericToJSON+  , parseJSON+  , toJSON+  , (.!=)+  , (.:)+  , (.:?)+  , (.=)+  )+import qualified Data.Aeson as Aeson+import qualified Data.Bool as Bool+import qualified Data.Scientific as Scientific+import qualified Data.Text as Text+import qualified Data.Vector as Vector++type JsonOptions = Aeson.Options+type JsonValue = Aeson.Value++pattern JsonNull :: JsonValue+pattern JsonNull = Aeson.Null++pattern JsonBoolean :: Bool.Bool -> JsonValue+pattern JsonBoolean x = Aeson.Bool x++pattern JsonNumber :: Scientific.Scientific -> JsonValue+pattern JsonNumber x = Aeson.Number x++pattern JsonString :: Text.Text -> JsonValue+pattern JsonString x = Aeson.String x++pattern JsonArray :: Vector.Vector JsonValue -> JsonValue+pattern JsonArray x = Aeson.Array x++pattern JsonObject :: Aeson.Object -> JsonValue+pattern JsonObject x = Aeson.Object x++{-# COMPLETE+  JsonNull,+  JsonBoolean,+  JsonNumber,+  JsonString,+  JsonArray,+  JsonObject #-}
+ Prolude/Core.hs view
@@ -0,0 +1,109 @@+module Prolude.Core+  ( module Control.Applicative+  , module Control.Monad+  , module Control.Monad.Fail+  , 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.Kind+  , module Data.List+  , module Data.Maybe+  , module Data.Monoid+  , module Data.Ord+  , module Data.Semigroup+  , module Data.String+  , module Data.Traversable+  , module Data.Tuple+  , module Data.Word+  , module GHC.Base+  , module GHC.Enum+  , module GHC.Err+  , module GHC.Float+  , module GHC.Generics+  , module GHC.IO.Exception+  , module GHC.List+  , module GHC.Num+  , module GHC.Real+  , module GHC.Show+  , module System.IO+  , module Text.Read+  , identity+  )+where++import Control.Applicative (Applicative(pure, (*>), (<*), (<*>)))+import Control.Monad (Monad((>>), (>>=)))+import Control.Monad.Fail (MonadFail(fail))+import Data.Bool (Bool(False, True), not, otherwise, (&&), (||))+import Data.Char (Char, chr, ord)+import Data.Either (Either(Left, Right), either)+import Data.Eq (Eq((/=), (==)))+import Data.Foldable+  (Foldable(elem, foldMap, foldr, length, null, sum), all, and, any, concat, concatMap, mapM_, or)+import Data.Function ((&))+import Data.Functor (Functor(fmap, (<$)), (<$>))+import Data.Int (Int)+import Data.Kind (Constraint, Type)+import Data.List+  ( break+  , drop+  , dropWhile+  , filter+  , lines+  , replicate+  , reverse+  , splitAt+  , take+  , takeWhile+  , unlines+  , unwords+  , unzip+  , words+  , zip+  , zipWith+  )+import Data.Maybe (Maybe(Just, Nothing), maybe)+import Data.Monoid (Monoid(mempty), mappend, mconcat)+import Data.Ord (Ord(compare, (<=)), Ordering(EQ, GT, LT), max, min, (<), (>), (>=))+import Data.Semigroup (Semigroup((<>)))+import Data.String (String)+import Data.Traversable (Traversable(mapM, sequence, traverse))+import Data.Tuple (curry, fst, snd, uncurry)+import Data.Word (Word)+import GHC.Base (asTypeOf, const, flip, return, seq, undefined, ($), (++), (.), (=<<))+import GHC.Enum (Bounded(maxBound, minBound), Enum(fromEnum, toEnum), pred, succ)+import GHC.Err (error)+import GHC.Float (Double, Float, Floating(logBase, (**)), RealFloat(isInfinite, isNaN))+import GHC.Generics (Generic)+import GHC.IO.Exception (IOError, userError)+import GHC.List (lookup, span)+import GHC.Num (Integer, Num(abs, fromInteger, negate, signum, (*), (+), (-)), subtract)+import GHC.Real+  ( Fractional(fromRational, recip, (/))+  , Integral(div, divMod, mod, quot, quotRem, rem, toInteger)+  , Ratio+  , Rational+  , Real(toRational)+  , RealFrac(ceiling, floor, round, truncate)+  , even+  , fromIntegral+  , gcd+  , lcm+  , odd+  , realToFrac+  , (^)+  , (^^)+  )+import GHC.Show (Show, show)+import System.IO (FilePath, IO, print, putStr, putStrLn)+import Text.Read (Read, read)++identity :: a -> a+identity x = x+{-# INLINE identity #-}+
+ Prolude/Exception.hs view
@@ -0,0 +1,22 @@+module Prolude.Exception+  ( module Control.Exception.Safe+  , UnsafeException.AsyncException(..)+  , catchIf+  , unsafeEvaluate+  , unsafeThrow+  )+where++import Prolude.Core++import qualified Control.Exception as UnsafeException+import Control.Exception.Safe hiding (catchIO, throwM)++unsafeEvaluate :: a -> IO a+unsafeEvaluate = UnsafeException.evaluate++unsafeThrow :: Exception e => e -> a+unsafeThrow = UnsafeException.throw++catchIf :: (MonadCatch m, Exception e) => (e -> Bool) -> m a -> (e -> m a) -> m a+catchIf f a b = catch a $ \e -> if f e then b e else throw e
+ Prolude/Json.hs view
@@ -0,0 +1,19 @@+module Prolude.Json+  ( module Data.Aeson+  , module Data.Aeson.Types+  , jsonEitherDecode+  , jsonEncode+  )+where++import Data.Aeson (FromJSON, ToJSON, eitherDecode, encode, withObject, withText)+import Data.Aeson.Types (Parser)+import Data.ByteString.Lazy (ByteString)+import Data.Either (Either)+import Data.String (String)++jsonEitherDecode :: FromJSON a => ByteString -> Either String a+jsonEitherDecode = eitherDecode++jsonEncode :: ToJSON a => a -> ByteString+jsonEncode = encode
+ Prolude/MongoDB.hs view
@@ -0,0 +1,163 @@+{-# LANGUAGE PatternSynonyms #-}+{-# LANGUAGE ConstraintKinds #-}++module Prolude.MongoDB+  ( module Database.MongoDB+  , MongoAction+  , MongoCollection+  , MongoDatabase+  , MongoDocument+  , MongoField+  , MongoLabel+  , MongoQuery+  , MongoValue+  , MongoVal+  , pattern MongoArray+  , pattern MongoBin+  , pattern MongoBool+  , pattern MongoDoc+  , pattern MongoFloat+  , pattern MongoFun+  , pattern MongoInt32+  , pattern MongoInt64+  , pattern MongoJavaScr+  , pattern MongoMd5+  , pattern MongoMinMax+  , pattern MongoNull+  , pattern MongoObjId+  , pattern MongoRegEx+  , pattern MongoStamp+  , pattern MongoString+  , pattern MongoSym+  , pattern MongoUserDef+  , pattern MongoUTC+  , pattern MongoUuid+  , mongoFailed+  , mongoInsert_+  , mongoModified+  , mongoSelect+  , mongoUpdateMany+  )+where++import Prolude.Core++import Control.Monad.IO.Class (MonadIO)+import Database.MongoDB (ObjectId, UpdateOption(MultiUpdate), fval, genObjectId, (=:))+import qualified Data.Int as Int+import qualified Data.Text as Text+import qualified Data.Time as Time+import qualified Database.MongoDB as Mongo++type MongoAction = Mongo.Action+type MongoCollection = Mongo.Collection+type MongoDatabase = Mongo.Database+type MongoDocument = Mongo.Document+type MongoField = Mongo.Field+type MongoLabel = Mongo.Label+type MongoQuery = Mongo.Query+type MongoSelector = Mongo.Selector+type MongoVal = Mongo.Val++type MongoValue = Mongo.Value++pattern MongoFloat :: Double -> MongoValue+pattern MongoFloat x = Mongo.Float x++pattern MongoString :: Text.Text -> MongoValue+pattern MongoString x = Mongo.String x++pattern MongoDoc :: Mongo.Document -> MongoValue+pattern MongoDoc x = Mongo.Doc x++pattern MongoArray :: [Mongo.Value] -> MongoValue+pattern MongoArray x = Mongo.Array x++pattern MongoBin :: Mongo.Binary -> MongoValue+pattern MongoBin x = Mongo.Bin x++pattern MongoFun :: Mongo.Function -> MongoValue+pattern MongoFun x = Mongo.Fun x++pattern MongoUuid :: Mongo.UUID -> MongoValue+pattern MongoUuid x = Mongo.Uuid x++pattern MongoMd5 :: Mongo.MD5 -> MongoValue+pattern MongoMd5 x = Mongo.Md5 x++pattern MongoUserDef :: Mongo.UserDefined -> MongoValue+pattern MongoUserDef x = Mongo.UserDef x++pattern MongoObjId :: Mongo.ObjectId -> MongoValue+pattern MongoObjId x = Mongo.ObjId x++pattern MongoBool :: Bool -> MongoValue+pattern MongoBool x = Mongo.Bool x++pattern MongoUTC :: Time.UTCTime -> MongoValue+pattern MongoUTC x = Mongo.UTC x++pattern MongoNull :: MongoValue+pattern MongoNull = Mongo.Null++pattern MongoRegEx :: Mongo.Regex -> MongoValue+pattern MongoRegEx x = Mongo.RegEx x++pattern MongoJavaScr :: Mongo.Javascript -> MongoValue+pattern MongoJavaScr x = Mongo.JavaScr x++pattern MongoSym :: Mongo.Symbol -> MongoValue+pattern MongoSym x = Mongo.Sym x++pattern MongoInt32 :: Int.Int32 -> MongoValue+pattern MongoInt32 x = Mongo.Int32 x++pattern MongoInt64 :: Int.Int64 -> MongoValue+pattern MongoInt64 x = Mongo.Int64 x++pattern MongoStamp :: Mongo.MongoStamp -> MongoValue+pattern MongoStamp x = Mongo.Stamp x++pattern MongoMinMax :: Mongo.MinMaxKey -> MongoValue+pattern MongoMinMax x = Mongo.MinMax x++{-# COMPLETE+  MongoFloat+  , MongoString+  , MongoDoc+  , MongoArray+  , MongoBin+  , MongoFun+  , MongoUuid+  , MongoMd5+  , MongoUserDef+  , MongoObjId+  , MongoBool+  , MongoUTC+  , MongoNull+  , MongoRegEx+  , MongoJavaScr+  , MongoSym+  , MongoInt32+  , MongoInt64+  , MongoStamp+  , MongoMinMax #-}++mongoFailed :: Mongo.WriteResult -> Bool+mongoFailed = Mongo.failed++mongoInsert_ :: MonadIO m => MongoCollection -> MongoDocument -> MongoAction m ()+mongoInsert_ = Mongo.insert_++mongoModified :: Mongo.WriteResult -> Maybe Int+mongoModified = Mongo.nModified++mongoSelect :: MongoSelector -> MongoCollection -> MongoQuery+mongoSelect = Mongo.select++mongoUpdateMany+  :: MonadIO m+  => MongoCollection+  -> [(MongoSelector, MongoDocument, [UpdateOption])]+  -> MongoAction m Mongo.WriteResult+mongoUpdateMany = Mongo.updateMany
+ Prolude/Text.hs view
@@ -0,0 +1,14 @@+module Prolude.Text+  ( module Data.Text+  , fromText+  , toText+  )+where++import Data.Text (Text, pack, unpack)++fromText :: Text -> String+fromText = unpack++toText :: String -> Text+toText = pack
+ Prolude/Time.hs view
@@ -0,0 +1,21 @@+module Prolude.Time+  ( module Data.Time.Calendar+  , module Data.Time.Clock+  , module Data.Time.Clock.POSIX+  , module Data.Time.Format+  , getCurrentTime+  )+where++import Data.Time.Calendar (Day, fromGregorian, toGregorian)+import Data.Time.Clock+  (DiffTime, NominalDiffTime, UTCTime(UTCTime, utctDay, utctDayTime), addUTCTime)+import Data.Time.Clock.POSIX (POSIXTime, getPOSIXTime, posixSecondsToUTCTime, utcTimeToPOSIXSeconds)+import Data.Time.Format (defaultTimeLocale, formatTime)++import Control.Monad.IO.Class (MonadIO(liftIO))+import qualified Data.Time as Time++-- | Returns now+getCurrentTime :: MonadIO m => m UTCTime+getCurrentTime = liftIO Time.getCurrentTime
+ prolude.cabal view
@@ -0,0 +1,42 @@+cabal-version: >= 1.10++name: prolude+version: 0.0.0.0+synopsis: ITProTV's custom prelude+description:+    Prolude is ITProTV's custom prelude.+    <https://www.itpro.tv>++build-type: Simple+category: Prelude+license: MIT+license-file: LICENSE.txt+maintainer: ITProTV++source-repository head+    type: git+    location: https://github.com/EdutainmentLIVE/prolude++library+    default-language: Haskell2010++    exposed-modules: +        Prolude+        Prolude.Aeson +        Prolude.Core +        Prolude.Exception +        Prolude.Json +        Prolude.MongoDB +        Prolude.Text +        Prolude.Time ++    build-depends: +        base >= 4.13.0 && < 4.15+        , aeson >= 1.4.7 && < 1.5+        , bytestring >= 0.10.10 && < 0.11+        , mongoDB >= 2.7.0 && < 2.8+        , safe-exceptions >= 0.1.7 && < 0.2+        , scientific >= 0.3.6 && < 0.4+        , text >= 1.2.3 && < 1.3+        , time >= 1.9.3 && < 1.10+        , vector >= 0.12.1 && < 0.13