intro (empty) → 0.0.1.0
raw patch · 5 files changed
+806/−0 lines, 5 filesdep +basedep +bifunctorsdep +binarysetup-changed
Dependencies added: base, bifunctors, binary, bytestring, containers, deepseq, dlist, extra, hashable, mtl, safe, string-conversions, tagged, text, transformers, unordered-containers, writer-cps-mtl
Files
- LICENSE +21/−0
- Setup.hs +2/−0
- intro.cabal +50/−0
- src/Intro.hs +681/−0
- src/Intro/Trustworthy.hs +52/−0
+ LICENSE view
@@ -0,0 +1,21 @@+The MIT License (MIT)++Copyright (c) 2016 Daniel Mendler++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.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ intro.cabal view
@@ -0,0 +1,50 @@+-- This file has been generated from package.yaml by hpack version 0.15.0.+--+-- see: https://github.com/sol/hpack++name: intro+version: 0.0.1.0+synopsis: Total, Texty, Transformer-Prelude+description: Total, Text, Transformer-Prelude+category: Prelude+homepage: https://github.com/minad/intro#readme+bug-reports: https://github.com/minad/intro/issues+author: Daniel Mendler <mail@daniel-mendler.de>+maintainer: Daniel Mendler <mail@daniel-mendler.de>+copyright: 2016 Daniel Mendler+license: MIT+license-file: LICENSE+tested-with: GHC == 8.0.1+build-type: Simple+cabal-version: >= 1.10++source-repository head+ type: git+ location: https://github.com/minad/intro++library+ hs-source-dirs:+ src+ ghc-options: -Wall+ build-depends:+ base >= 4.9 && < 5.0+ , bifunctors >= 5.4.1 && < 5.5+ , binary >= 0.8.3.0 && < 0.9+ , bytestring >= 0.9 && < 0.11+ , containers >= 0.5.7.1 && < 0.6+ , deepseq >= 1.4.2.0 && < 1.5+ , dlist >= 0.8.0.2 && < 0.9+ , extra >= 1.5.1 && < 1.6+ , hashable >= 1.2.4.0 && < 1.3+ , mtl >= 2.2.1 && < 2.3+ , safe >= 0.3.10 && < 0.4+ , string-conversions >= 0.4 && < 0.5+ , tagged >= 0.8.5 && < 0.9+ , text >= 0.7 && < 1.3+ , transformers >= 0.5.2.0 && < 0.6+ , unordered-containers >= 0.2.7.1 && < 0.3+ , writer-cps-mtl >= 0.1.1 && < 0.2+ exposed-modules:+ Intro+ Intro.Trustworthy+ default-language: Haskell2010
+ src/Intro.hs view
@@ -0,0 +1,681 @@+{-# LANGUAGE Safe #-}+{-# LANGUAGE FlexibleContexts #-}+module Intro (+ module X,+ LText,+ LByteString,+ (.:),+ (<>^),+ skip,+ panic,+ map,+ print,+ getContents,+ getLine,+ getChar,+ putChar,+ putStr,+ putStrLn,+ show,+ showS,+ readMaybe,+ undefined,+ readFile,+ writeFile,+ appendFile,+ readFileUtf8,+ writeFileUtf8,+ appendFileUtf8,+) where++import Data.Either.Extra as X (+ fromLeft,+ fromRight,+ eitherToMaybe,+ maybeToEither,+ )++import Control.Monad.Extra as X (+ whenM,+ unlessM,+ ifM,+ allM,+ anyM,+ andM,+ orM,+ concatMapM,+ (&&^),+ (||^),+ )++import Data.List.Extra as X (+ nubOrd,+ nubOrdOn,+ nubOrdBy,+ groupOn,+ dropEnd,+ takeEnd,+ )++import Data.Text as X (+ Text,+-- lines,+-- words,+-- unlines,+-- unwords,+ )++import Data.ByteString as X (+ ByteString+ )++import Data.Map.Strict as X (+ Map,+ )++import Data.IntMap.Strict as X (+ IntMap,+ )++import Data.Set as X (+ Set,+ )++import Data.IntSet as X (+ IntSet,+ )++import Data.Sequence as X (+ Seq,+ )++import Data.HashMap.Strict as X (+ HashMap,+ )++import Data.HashSet as X (+ HashSet,+ )++import Data.Hashable as X (+ Hashable,+ )++import Data.Int as X (+ Int,+ Int8,+ Int16,+ Int32,+ Int64,+ )++import Data.Bits as X (+ Bits((.&.), (.|.), xor, complement, shift, rotate, zeroBits,+ bit, setBit, clearBit, complementBit, testBit,+ -- bitSize, bitSizeMaybe+ isSigned,+ -- unsafeShiftL+ -- unsafeShiftR+ -- shiftR, shiftL,+ rotateL, rotateR, popCount),+ FiniteBits(finiteBitSize, countLeadingZeros, countTrailingZeros)+ )++import Data.Tuple as X (+ fst,+ snd,+ curry,+ uncurry,+ swap+ )++import Data.Word as X (+ Word,+ Word8,+ Word16,+ Word32,+ Word64,+ )++import Data.Function as X (+-- id,+ const,+-- (.),+ flip,+ ($),+ (&),+ fix,+ on,+ )++import Data.Either as X (+ Either(Left, Right),+ either,+ lefts,+ rights,+ isLeft,+ isRight,+ partitionEithers,+ )++import Data.Maybe as X (+ Maybe(Nothing, Just),+ maybe,+ isJust,+ isNothing,+ fromMaybe,+ listToMaybe,+ maybeToList,+ catMaybes,+ mapMaybe,+ )++import Data.Bool as X (+ Bool(False, True),+ (&&),+ (||),+ not,+ otherwise,+ bool,+ )++import Data.Functor as X (+ Functor((<$)),+ --fmap,+ ($>),+ (<$>),+ void+ )++import Data.Functor.Classes as X (+ Eq1, Eq2,+ Ord1, Ord2,+ Show1, Show2,+ Read1, Read2+ )++import Data.Bifunctor as X (+ Bifunctor(bimap, first, second),+ )++import Data.Bifoldable as X (+ Bifoldable(bifoldr, bifoldl, bifoldMap),+ bitraverse_,+ bisequenceA_,+ bifor_,+ )++import Data.Bitraversable as X (+ Bitraversable(bitraverse),+ bifor,+ bisequenceA,+ )++import Data.Void as X (+ Void,+ absurd+ )++import Data.Kind as X (+ Type,+ Constraint,+ )++import Control.Category as X (+ id,+ (.),+ (<<<),+ (>>>)+ )++import Data.Semigroup as X (+ Semigroup((<>), sconcat, stimes),+ First(First, getFirst),+ Last(Last, getLast),+ Min(Min, getMin),+ Max(Max, getMax),+ Option(Option, getOption),+ )++import Data.Monoid as X (+ Monoid(mempty, mappend, mconcat),+ Dual(Dual, getDual),+ Endo(Endo, appEndo),+ All(All, getAll),+ Any(Any, getAny),+ -- Hide because of name clash with sum functors+ --Sum(Sum, getSum),+ --Product(Product, getProduct),+ -- Provide semigroup instances instead+ --First(First, getFirst),+ --Last(Last, getLast),+ Alt(Alt, getAlt),+ )++import Data.Eq as X (+ Eq((==), (/=)),+ )++import Data.Ord as X (+ Ord(compare, (<), (>), (<=), (>=), max, min),+ Ordering(LT,GT,EQ),+ Down(Down),+ comparing+ )++import Text.Show as X (+ Show+ )++import Text.Read as X (+ Read+ )++import Control.Applicative as X (+ Applicative(pure, (<*>), (*>), (<*)),+ Alternative((<|>), empty, many {-, some -}),+ Const(Const, getConst),+ ZipList(ZipList, getZipList),+ (<**>),+ optional,+ liftA2,+ liftA3,+ )++import Control.Monad as X (+ Monad((>>=)),+ (=<<),+ (<=<),+ (>=>),+ MonadPlus(mzero, mplus),+ join,+ guard,+ when,+ unless,+ replicateM,+ replicateM_,+ (<$!>)+ )++import Control.Monad.Fail as X (+ MonadFail(fail),+ )++import Data.Foldable as X (+ Foldable(elem, fold, foldMap,+ foldr, foldr',+ -- foldl, -- hide the bad one+ foldl',+ product, sum, toList),+ null,+ length,+ foldrM,+ foldlM,+ traverse_,+ for_,+ asum,+ concatMap,+ all,+ any,+ or,+ and,+ find,+ notElem,+ sequenceA_,+ )++import Safe as X (+ headMay,+ headDef,+ tailMay,+ tailDef,+ initMay,+ initDef,+ lastMay,+ lastDef,+ toEnumMay,+ toEnumDef,+ cycleMay,+ cycleDef+ )++import Safe.Foldable as X (+ maximumByMay,+ maximumByDef,+ minimumByMay,+ minimumByDef,+ maximumMay,+ maximumDef,+ minimumMay,+ minimumDef,+ )++import Data.Ratio as X (+ Ratio,+ Rational,+ (%),+ numerator,+ denominator,+ approxRational+ )++import Numeric.Natural as X (+ Natural+ )++import Prelude as X (+ ($!),+ (^), -- partial functions!+ (^^),+ seq,+ Char,+ String,+ Float,+ Double,+ Integer,+ FilePath,+ realToFrac,+ even,+ odd,+ asTypeOf,+ until,+ fromIntegral,+ Num((+), (-), (*), negate, abs, signum, fromInteger),+ Real(toRational),+ Integral(quot, rem, div, mod, quotRem, divMod, toInteger), -- partial functions!+ Fractional((/), recip, fromRational), -- partial functions+ Floating(pi, exp, log, sqrt, (**), logBase, sin, cos, tan,+ asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh),+ RealFrac(properFraction, truncate, round, ceiling, floor), -- partial functions+ RealFloat(floatRadix, floatDigits, floatRange, decodeFloat,+ encodeFloat, exponent, significand, scaleFloat, isNaN,+ isInfinite, isDenormalized, isIEEE, isNegativeZero, atan2),+ Enum(-- toEnum, succ, pred, -- partial+ fromEnum, enumFrom, enumFromThen,+ enumFromTo, enumFromThenTo),+ Bounded(minBound, maxBound),+ )++import System.IO as X (+ IO+ )++import Data.List as X (+ splitAt,+ break,+ span,+ intercalate,+ isPrefixOf,+ isSuffixOf,+ drop,+ filter,+ reverse,+ replicate,+ take,+ sortBy,+ sortOn,+ sort,+ intersperse,+ transpose,+ subsequences,+ permutations,+ scanl,+ scanr,+ iterate,+ repeat,+ -- cycle, -- partial+ unfoldr,+ takeWhile,+ dropWhile,+ dropWhileEnd,+ group,+ groupBy,+ inits,+ tails,+ zip,+ zip3,+ zipWith,+ zipWith3,+ lookup,+ unzip,+ unzip3+ )++import Data.List.NonEmpty as X (+ NonEmpty((:|)),+ (<|),+ some1,+ scanl1,+ scanr1+ )++import Data.Traversable as X (+ Traversable(traverse, sequenceA),+ for,+ mapAccumL,+ mapAccumR,+ )++import Data.Functor.Identity as X (+ Identity(Identity, runIdentity),+ )++import Control.Monad.Reader as X (+ MonadReader(ask, local, reader),+ --asks,+ Reader,+ runReader,+ mapReader,+ withReader,+ ReaderT(ReaderT, runReaderT),+ mapReaderT,+ withReaderT+ )++import Control.Monad.Trans.Maybe as X (+ MaybeT(MaybeT, runMaybeT),+ mapMaybeT,+ )++import Control.Monad.Except as X (+ MonadError(throwError, catchError),+ ExceptT(ExceptT),+ runExceptT,+ mapExceptT,+ withExceptT,+ Except,+ runExcept,+ mapExcept,+ withExcept,+ )++import Control.Monad.State.Strict as X (+ MonadState(get, put, state),+ State,+ --gets,+ modify,+ modify',+ runState,+ evalState,+ execState,+ mapState,+ withState,+ StateT(StateT, runStateT),+ evalStateT,+ execStateT,+ mapStateT,+ withStateT,+ )++import Control.Monad.RWS.CPS as X (+ MonadRWS,+ RWS,+ runRWS,+ evalRWS,+ execRWS,+ mapRWS,+ RWST,+ runRWST,+ evalRWST,+ execRWST,+ mapRWST,+ )++import Control.Monad.Writer.CPS as X (+ MonadWriter(writer, tell, listen, pass),+ Writer,+ runWriter,+ execWriter,+ mapWriter,+ WriterT,+ runWriterT,+ execWriterT,+ mapWriterT,+ )++import Control.Monad.Trans as X (+ MonadTrans(lift),+ MonadIO(liftIO),+ )++import GHC.Generics as X (+ Generic+ )++import Data.Typeable as X (+ Typeable+ )++-- import Data.Data as X (+-- Data+-- )++import Data.String as X (+ IsString(fromString)+ )++import Data.Proxy as X (+ Proxy(Proxy)+ )++import Data.Tagged as X (+ Tagged(Tagged, unTagged)+ )++import Data.String.Conversions as X (+ ConvertibleStrings(convertString)+ )++import Control.DeepSeq as X (+ NFData+ )++import Data.Binary as X (+ Binary+ )++import Intro.Trustworthy as X++import qualified Prelude+import qualified GHC.Stack.Types+import qualified Data.Functor+import qualified Data.Text.IO+import qualified Data.ByteString+import qualified Data.ByteString.Lazy+import qualified Data.Text.Lazy+import qualified Text.Read+import qualified Text.Show+import qualified System.IO++type LText = Data.Text.Lazy.Text+type LByteString = Data.ByteString.Lazy.ByteString++map :: Functor f => (a -> b) -> f a -> f b+map = Data.Functor.fmap+{-# INLINE map #-}++show :: (Show a, ConvertibleStrings String b) => a -> b+show = convertString . showS+{-# INLINE show #-}++showS :: Show a => a -> String+showS = Text.Show.show+{-# INLINE showS #-}++readMaybe :: (Read b, ConvertibleStrings a String) => a -> Maybe b+readMaybe = Text.Read.readMaybe . convertString+{-# INLINE readMaybe #-}++print :: (MonadIO m, Show a) => a -> m ()+print = liftIO . System.IO.print+{-# INLINE print #-}++getContents :: MonadIO m => m Text+getContents = liftIO Data.Text.IO.getContents+{-# INLINE getContents #-}++getLine :: MonadIO m => m Text+getLine = liftIO Data.Text.IO.getLine+{-# INLINE getLine #-}++getChar :: MonadIO m => m Char+getChar = liftIO System.IO.getChar+{-# INLINE getChar #-}++putStr, putStrLn :: MonadIO m => Text -> m ()+putStr = liftIO . Data.Text.IO.putStr+putStrLn = liftIO . Data.Text.IO.putStrLn+{-# INLINE putStr #-}+{-# INLINE putStrLn #-}++putChar :: MonadIO m => Char -> m ()+putChar = liftIO . System.IO.putChar+{-# INLINE putChar #-}++readFile :: MonadIO m => FilePath -> m ByteString+readFile = liftIO . Data.ByteString.readFile+{-# INLINE readFile #-}++writeFile :: MonadIO m => FilePath -> ByteString -> m ()+writeFile = liftIO .: Data.ByteString.writeFile+{-# INLINE writeFile #-}++appendFile :: MonadIO m => FilePath -> ByteString -> m ()+appendFile = liftIO .: Data.ByteString.appendFile+{-# INLINE appendFile #-}++readFileUtf8 :: MonadIO m => FilePath -> m Text+readFileUtf8 = map convertString . readFile+{-# INLINE readFileUtf8 #-}++writeFileUtf8 :: MonadIO m => FilePath -> Text -> m ()+writeFileUtf8 file = writeFile file . convertString+{-# INLINE writeFileUtf8 #-}++appendFileUtf8 :: MonadIO m => FilePath -> Text -> m ()+appendFileUtf8 file = appendFile file . convertString+{-# INLINE appendFileUtf8 #-}++{-# WARNING undefined "'undefined' remains in code" #-}+undefined :: GHC.Stack.Types.HasCallStack => a+undefined = Prelude.undefined++infixr 6 <>^+(<>^) :: (Applicative f, Semigroup a) => f a -> f a -> f a+(<>^) = liftA2 (<>)+{-# INLINE (<>^) #-}++infixr 8 .:+(.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d+(.:) = (.) . (.)+{-# INLINE (.:) #-}++skip :: Applicative m => m ()+skip = pure ()+{-# INLINE skip #-}++panic :: GHC.Stack.Types.HasCallStack => a+panic = Prelude.error $+ "Panic!\n" <>+ "Please submit a bug report including the stacktrace\n" <>+ "and a description on how to reproduce the bug."
+ src/Intro/Trustworthy.hs view
@@ -0,0 +1,52 @@+{-# LANGUAGE Trustworthy #-}+module Intro.Trustworthy (+ module X,+ trace,+ traceIO,+ traceM,+ traceShow,+ traceShowM,+ traceStack,+ traceStackM,+) where++import Data.DList as X (+ DList,+ )++import GHC.Exts as X (+ IsList(Item, fromList+ -- , toList+ )+ )++import qualified Data.Text+import qualified Debug.Trace++{-# WARNING trace "'trace' remains in code" #-}+trace :: Data.Text.Text -> a -> a+trace = Debug.Trace.trace . Data.Text.unpack++{-# WARNING traceStack "'traceStack' remains in code" #-}+traceStack :: Data.Text.Text -> a -> a+traceStack = Debug.Trace.traceStack . Data.Text.unpack++{-# WARNING traceStackM "'traceStackM' remains in code" #-}+traceStackM :: Monad m => Data.Text.Text -> m ()+traceStackM s = traceStack s $ pure ()++{-# WARNING traceShow "'traceShow' remains in code" #-}+traceShow :: Show a => a -> b -> b+traceShow = Debug.Trace.traceShow++{-# WARNING traceShowM "'traceShowM' remains in code" #-}+traceShowM :: (Show a, Monad m) => a -> m ()+traceShowM = Debug.Trace.traceShowM++{-# WARNING traceM "'traceM' remains in code" #-}+traceM :: Monad m => Data.Text.Text -> m ()+traceM = Debug.Trace.traceM . Data.Text.unpack++{-# WARNING traceIO "'traceIO' remains in code" #-}+traceIO :: Data.Text.Text -> IO ()+traceIO = Debug.Trace.traceIO . Data.Text.unpack