Merge branch 'docs'
Conflicts: CHANGES.md
This commit is contained in:
+3
-1
@@ -1,10 +1,12 @@
|
|||||||
0.1.11
|
0.2
|
||||||
====
|
====
|
||||||
|
|
||||||
* Expose `Symbol` and `Nat` types from `GHC.TypeLits` by default.
|
* Expose `Symbol` and `Nat` types from `GHC.TypeLits` by default.
|
||||||
* Switch exported `(<>)` to be from `Data.Monoid` instead of Semigroup.
|
* Switch exported `(<>)` to be from `Data.Monoid` instead of Semigroup.
|
||||||
* Expose `putByteString` and `putLByteString` monomorphic versions of `putStrLn` functions
|
* Expose `putByteString` and `putLByteString` monomorphic versions of `putStrLn` functions
|
||||||
* Export `genericLength` and other generic list return functions.
|
* Export `genericLength` and other generic list return functions.
|
||||||
|
* Export `ExceptT`, `ReaderT`, and `StateT` constructors.
|
||||||
|
* Export `NonEmpty` type and constructor for GHC 8.0.
|
||||||
|
|
||||||
0.1.9
|
0.1.9
|
||||||
====
|
====
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2016, Stephen Diehl
|
Copyright (c) 2016-2017, Stephen Diehl
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to
|
of this software and associated documentation files (the "Software"), to
|
||||||
|
|||||||
@@ -92,9 +92,8 @@ tracks Stack LTS resolver.
|
|||||||
| Dependencies | Lower | Upper |
|
| Dependencies | Lower | Upper |
|
||||||
| ----------- | -------- | -------- |
|
| ----------- | -------- | -------- |
|
||||||
| array | | 0.5 |
|
| array | | 0.5 |
|
||||||
| async | 2.1 | 2.2 |
|
| async | 2.0 | 2.2 |
|
||||||
| base | 4.6 | 4.10 |
|
| base | 4.6 | 4.10 |
|
||||||
| binary | | 0.7 |
|
|
||||||
| bytestring | 0.10 | 0.11 |
|
| bytestring | 0.10 | 0.11 |
|
||||||
| containers | 0.5 | 0.6 |
|
| containers | 0.5 | 0.6 |
|
||||||
| deepseq | 1.3 | 1.5 |
|
| deepseq | 1.3 | 1.5 |
|
||||||
@@ -104,6 +103,7 @@ tracks Stack LTS resolver.
|
|||||||
| safe | 0.3 | 0.4 |
|
| safe | 0.3 | 0.4 |
|
||||||
| stm | 2.4 | 2.5 |
|
| stm | 2.4 | 2.5 |
|
||||||
| text | 1.2 | 1.3 |
|
| text | 1.2 | 1.3 |
|
||||||
|
| hashable | 1.2 | 1.3 |
|
||||||
| transformers | 0.4 | 0.6 |
|
| transformers | 0.4 | 0.6 |
|
||||||
|
|
||||||
FAQs
|
FAQs
|
||||||
@@ -161,4 +161,4 @@ License
|
|||||||
-------
|
-------
|
||||||
|
|
||||||
Released under the MIT License.
|
Released under the MIT License.
|
||||||
Copyright (c) 2016, Stephen Diehl
|
Copyright (c) 2016-2017, Stephen Diehl
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
_build
|
||||||
+19
-7
@@ -1,7 +1,8 @@
|
|||||||
Applicative
|
Applicative
|
||||||
===========
|
===========
|
||||||
|
|
||||||
#### Functor
|
Functor
|
||||||
|
-------
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
class Functor (f :: * -> *) where
|
class Functor (f :: * -> *) where
|
||||||
@@ -17,7 +18,8 @@ class Functor (f :: * -> *) where
|
|||||||
($>) :: Functor f => f a -> b -> f b
|
($>) :: Functor f => f a -> b -> f b
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Applicatives
|
Applicatives
|
||||||
|
-------
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
class Functor f => Applicative (f :: * -> *) where
|
class Functor f => Applicative (f :: * -> *) where
|
||||||
@@ -27,10 +29,6 @@ class Functor f => Applicative (f :: * -> *) where
|
|||||||
(<*) :: f a -> f b -> f a
|
(<*) :: f a -> f b -> f a
|
||||||
```
|
```
|
||||||
|
|
||||||
```haskell
|
|
||||||
(<$>) :: Functor f => (a -> b) -> f a -> f b
|
|
||||||
```
|
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
orAlt :: (Alternative f, Monoid a) => f a -> f a
|
orAlt :: (Alternative f, Monoid a) => f a -> f a
|
||||||
```
|
```
|
||||||
@@ -43,7 +41,13 @@ orEmpty :: Alternative f => Bool -> a -> f a
|
|||||||
eitherA :: (Alternative f) => f a -> f b -> f (Either a b)
|
eitherA :: (Alternative f) => f a -> f b -> f (Either a b)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Alternative
|
```haskell
|
||||||
|
pass :: Applicative f => f ()
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Alternative
|
||||||
|
-------
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
class Applicative f => Alternative (f :: * -> *) where
|
class Applicative f => Alternative (f :: * -> *) where
|
||||||
@@ -76,3 +80,11 @@ liftA :: Applicative f => (a -> b) -> f a -> f b
|
|||||||
```haskell
|
```haskell
|
||||||
empty :: Alternative f => f a
|
empty :: Alternative f => f a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
guarded :: (Alternative f) => (a -> Bool) -> a -> f a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
guardedA :: (Functor f, Alternative t) => (a -> f Bool) -> a -> f (t a)
|
||||||
|
```
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Bifunctor
|
||||||
|
=========
|
||||||
+202
@@ -0,0 +1,202 @@
|
|||||||
|
Bits
|
||||||
|
====
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
{-# LANGUAGE BinaryLiterals #-}
|
||||||
|
```
|
||||||
|
|
||||||
|
```python
|
||||||
|
42 = 0b101010
|
||||||
|
```
|
||||||
|
|
||||||
|
Bit Operations
|
||||||
|
--------------
|
||||||
|
|
||||||
|
#### .&.
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
(.&.) :: Bits a => a -> a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### .|.
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
(.|.) :: Bits a => a -> a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### xor
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
xor :: Bits a => a -> a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> True `xor` False
|
||||||
|
True
|
||||||
|
|
||||||
|
> True `xor` True
|
||||||
|
False
|
||||||
|
|
||||||
|
> 0b101 `xor` 0b011
|
||||||
|
6 -- 0b110
|
||||||
|
```
|
||||||
|
|
||||||
|
#### complement
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
complement :: Bits a => a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> complement True
|
||||||
|
False
|
||||||
|
|
||||||
|
> complement 0b101
|
||||||
|
-2 -- -0b010
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### shift
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
shift :: Bits a => a -> Int -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### rotate
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
rotate :: Bits a => a -> Int -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### zeroBits
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
zeroBits :: Bits a => a
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### bit
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
bit :: Bits a => Int -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
Bit Testing
|
||||||
|
------------
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
setBit :: Bits a => a -> Int -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
clearBit :: Bits a => a -> Int -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
#### complementBit
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
complementBit :: Bits a => a -> Int -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
λ> 0b100 `complementBit` 1
|
||||||
|
6 -- 0b110
|
||||||
|
```
|
||||||
|
|
||||||
|
#### testBit
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
testBit :: Bits a => a -> Int -> Bool
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> 0b10 `testBit` 0
|
||||||
|
False
|
||||||
|
> 0b10 `testBit` 1
|
||||||
|
True
|
||||||
|
```
|
||||||
|
|
||||||
|
#### isSigned
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
isSigned :: Bits a => a -> Bool
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> isSigned 42
|
||||||
|
True
|
||||||
|
> isSigned True
|
||||||
|
False
|
||||||
|
```
|
||||||
|
|
||||||
|
Bit Size
|
||||||
|
------------
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
bitSize :: Bits a => a -> Int
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
popCount :: Bits a => a -> Int
|
||||||
|
```
|
||||||
|
|
||||||
|
Bit Shifting
|
||||||
|
------------
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
shiftL :: Bits a => a -> Int -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
shiftR :: Bits a => a -> Int -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
Bit Rotation
|
||||||
|
------------
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
rotate :: Bits a => a -> Int -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
rotateL :: Bits a => a -> Int -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
rotateR :: Bits a => a -> Int -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
Byte Swapping
|
||||||
|
------------
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
byteSwap16 :: Word16 -> Word16
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
byteSwap32 :: Word32 -> Word32
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
byteSwap64 :: Word64 -> Word64
|
||||||
|
```
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
Bool
|
||||||
|
=====
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
bool :: a -> a -> Bool -> a
|
||||||
|
```
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Concurrency
|
||||||
|
===========
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
Debug
|
||||||
|
=====
|
||||||
|
|
||||||
|
Stubbing
|
||||||
|
--------
|
||||||
|
|
||||||
|
#### undefined
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
undefined :: a
|
||||||
|
```
|
||||||
|
|
||||||
|
An undefined expression standing in for an incomplete program, unevaluated type
|
||||||
|
witness, or unreachable code branch.
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> import Foreign.Storable
|
||||||
|
> print (sizeOf (undefined :: Int))
|
||||||
|
8
|
||||||
|
```
|
||||||
|
|
||||||
|
#### notImplemented
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
notImplemented :: a
|
||||||
|
```
|
||||||
|
|
||||||
|
An undefined expression standing in for a yet to completed program.
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
main :: IO ()
|
||||||
|
main = notImplemented
|
||||||
|
```
|
||||||
|
|
||||||
|
Tracing
|
||||||
|
-------
|
||||||
|
|
||||||
|
#### trace
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
trace :: Print b => b -> a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### traceM
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
traceM :: (Monad m) => Text -> m ()
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### traceId
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
traceId :: Text -> Text
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### traceShowM
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
traceShowM :: (P.Show a, Monad m) => a -> m ()
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### traceShowId
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
traceShowId :: P.Show a => a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### traceShow
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
traceShow :: P.Show a => a -> b -> b
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### traceIO
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
traceIO :: Print b => b -> a -> IO a
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Either
|
||||||
|
======
|
||||||
+63
-9
@@ -1,7 +1,8 @@
|
|||||||
Exception Handling
|
Exceptions
|
||||||
==================
|
==========
|
||||||
|
|
||||||
#### MonadError
|
MonadError
|
||||||
|
----------
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
class Monad m => MonadError e (m :: * -> *) | m -> e where
|
class Monad m => MonadError e (m :: * -> *) | m -> e where
|
||||||
@@ -9,34 +10,55 @@ class Monad m => MonadError e (m :: * -> *) | m -> e where
|
|||||||
catchError :: m a -> (e -> m a) -> m a
|
catchError :: m a -> (e -> m a) -> m a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Except
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
type Except e = ExceptT e Identity
|
type Except e = ExceptT e Identity
|
||||||
```
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ExceptT
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
newtype ExceptT e (m :: * -> *) a
|
newtype ExceptT e (m :: * -> *) a
|
||||||
= Control.Monad.Trans.Except.ExceptT (m (Either e a))
|
= Control.Monad.Trans.Except.ExceptT (m (Either e a))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
```
|
||||||
|
|
||||||
|
#### throwError
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
throwError :: MonadError e m => e -> m a
|
throwError :: MonadError e m => e -> m a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### catchError
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
catchError :: MonadError e m => m a -> (e -> m a) -> m a
|
catchError :: MonadError e m => m a -> (e -> m a) -> m a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### runExcept
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
runExcept :: Except e a -> Either e a
|
runExcept :: Except e a -> Either e a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### runExceptT
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
runExceptT :: ExceptT e m a -> m (Either e a)
|
runExceptT :: ExceptT e m a -> m (Either e a)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Exceptions
|
Exceptions
|
||||||
|
----------
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
class (Typeable e, Show e) => Exception e where
|
class (Typeable e, Show e) => Exception e where
|
||||||
@@ -45,28 +67,60 @@ class (Typeable e, Show e) => Exception e where
|
|||||||
GHC.Exception.displayException :: e -> String
|
GHC.Exception.displayException :: e -> String
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### throwIO
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
throwIO :: (MonadIO m, Exception e) => e -> m a
|
throwIO :: (MonadIO m, Exception e) => e -> m a
|
||||||
```
|
```
|
||||||
|
|
||||||
```haskell
|
#### throwSTM
|
||||||
throwTo :: (MonadIO m, Exception e) => ThreadId -> e -> m ()
|
|
||||||
```
|
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
throwSTM :: Exception e => e -> STM a
|
throwSTM :: Exception e => e -> STM a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### throwTo
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
throwError :: MonadError e m => e -> m a
|
throwTo :: (MonadIO m, Exception e) => ThreadId -> e -> m ()
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Panic
|
Utilities
|
||||||
|
---------
|
||||||
|
|
||||||
|
#### hush
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
hush :: Alternative m => Either e a -> m a
|
||||||
|
```
|
||||||
|
|
||||||
|
#### note
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
note :: (MonadError e m, Applicative m) => e -> Maybe a -> m a
|
||||||
|
```
|
||||||
|
|
||||||
|
#### tryIO
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
tryIO :: MonadIO m => IO a -> ExceptT IOException m a
|
||||||
|
```
|
||||||
|
|
||||||
|
Fatal Errors
|
||||||
|
------------
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
data FatalError = FatalError {msg :: Text}
|
data FatalError = FatalError {msg :: Text}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### panic
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
panic :: Text -> a
|
panic :: Text -> a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Terminate with an uncatchable fatal error.
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> panic "Fatal error occured.
|
||||||
|
```
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
Files
|
||||||
|
=====
|
||||||
|
|
||||||
|
Basic IO
|
||||||
|
--------
|
||||||
|
|
||||||
|
#### readFile
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
readFile :: FilePath -> IO Text
|
||||||
|
```
|
||||||
|
|
||||||
|
#### writeFile
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
writeFile :: FilePath -> Text -> IO ()
|
||||||
|
```
|
||||||
|
|
||||||
|
#### appendFile
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
appendFile :: FilePath -> Text -> IO ()
|
||||||
|
```
|
||||||
|
|
||||||
|
Console
|
||||||
|
-------
|
||||||
|
|
||||||
|
#### getLine
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
getLine :: IO Text
|
||||||
|
```
|
||||||
|
|
||||||
|
#### getContents
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
getContents :: IO Text
|
||||||
|
```
|
||||||
|
|
||||||
|
#### interact
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
interact :: (Text -> Text) -> IO ()
|
||||||
|
```
|
||||||
|
|
||||||
|
File Handles
|
||||||
|
------------
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
data IOMode
|
||||||
|
= ReadMode
|
||||||
|
| WriteMode
|
||||||
|
| AppendMode
|
||||||
|
| ReadWriteMode
|
||||||
|
```
|
||||||
|
|
||||||
|
#### openFile
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
openFile :: FilePath -> IOMode -> IO Handle
|
||||||
|
```
|
||||||
|
|
||||||
|
#### withFile
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
withFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO r
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### stdin
|
||||||
|
#### stdout
|
||||||
|
#### stderr
|
||||||
|
#### Handle
|
||||||
|
#### FilePath
|
||||||
+171
@@ -0,0 +1,171 @@
|
|||||||
|
Folds
|
||||||
|
=====
|
||||||
|
|
||||||
|
Basic Folds
|
||||||
|
-----------
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
foldr' :: Foldable t => (a -> b -> b) -> b -> t a -> b
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
fold :: Foldable t => Monoid m => t m -> m
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
toList :: Foldable t => t a -> [a]
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
null :: Foldable t => t a -> Bool
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
length :: Foldable t => t a -> Int
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
elem :: (Eq a, Foldable t) => a -> t a -> Bool
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
maximum :: (Ord a, Foldable t) => t a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
minimum :: (Ord a, Foldable t) => t a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
sum :: (Num a, Foldable f) => f a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
product :: (Num a, Foldable f) => f a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Folding actions
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
>>> for_ [1..4] print
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Applicative Folds
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f ()
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
asum :: (Foldable t, Alternative f) => t (f a) -> f a
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Monadic Folds
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
msum :: (Foldable t, MonadPlus m) => t (m a) -> m a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
foldrM :: (Foldable t, Monad m) => (a -> b -> m b) -> b -> t a -> m b
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Specialized folds
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
concat :: Foldable t => t [a] -> [a]
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
and :: Foldable t => t Bool -> Bool
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
or :: Foldable t => t Bool -> Bool
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
any :: Foldable t => (a -> Bool) -> t a -> Bool
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
all :: Foldable t => (a -> Bool) -> t a -> Bool
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Searches
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
notElem :: (Foldable t, Eq a) => a -> t a -> Bool
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
find :: Foldable t => (a -> Bool) -> t a -> Maybe a
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
foldr1May :: (a -> a -> a) -> [a] -> Maybe a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
foldl1May :: (a -> a -> a) -> [a] -> Maybe a
|
||||||
|
```
|
||||||
+108
-5
@@ -1,50 +1,153 @@
|
|||||||
Functions
|
Functions
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
Composition
|
||||||
|
-----------
|
||||||
|
|
||||||
|
#### $
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
($) :: (a -> b) -> a -> b
|
($) :: (a -> b) -> a -> b
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Infix form of function application. Applies a function from ``a → b`` to an
|
||||||
|
argument ``a``.
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
(&) :: a -> (a -> b) -> b
|
> take 2 $ [1,2,3]
|
||||||
|
[1,2]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### .
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
(.) :: (b -> c) -> (a -> b) -> a -> c
|
(.) :: (b -> c) -> (a -> b) -> a -> c
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Function composition. Composes a function ``f`` (``b → c``) with a function
|
||||||
|
``g`` (``a → b``) yielding ``f ∘ g``.
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> map (negate . abs) [-1,0,1]
|
||||||
|
[-1,0,-1]
|
||||||
|
```
|
||||||
|
|
||||||
|
#### &
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
(&) :: a -> (a -> b) -> b
|
||||||
|
```
|
||||||
|
|
||||||
|
Flipped form of ``($)`` which applies an argument ``a`` to a function ``a → b``.
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> [1,2,3] & take 2
|
||||||
|
[1,2]
|
||||||
|
|
||||||
|
> replicate 10 3 & take 5 & tail
|
||||||
|
[3,3,3,3]
|
||||||
|
```
|
||||||
|
|
||||||
|
#### flip
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
flip :: (a -> b -> c) -> b -> a -> c
|
flip :: (a -> b -> c) -> b -> a -> c
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Flip takes a function of two arguments and returns a function taking the them in
|
||||||
|
reverse order.
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
λ> flip take [1,2,3] 2
|
||||||
|
[1,2]
|
||||||
|
```
|
||||||
|
|
||||||
|
#### on
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
|
on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
|
||||||
```
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> sortBy (compare `on` fst) [(1,2), (3,4), (0,1)]
|
||||||
|
[(0,1),(1,2),(3,4)]
|
||||||
|
```
|
||||||
|
|
||||||
|
#### const
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
const :: a -> b -> a
|
const :: a -> b -> a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### fix
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
fix :: (a -> a) -> a
|
fix :: (a -> a) -> a
|
||||||
```
|
```
|
||||||
|
|
||||||
```haskell
|
*Example*:
|
||||||
($!) :: (a -> b) -> a -> b
|
|
||||||
```
|
#### identity
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
identity :: a -> a
|
identity :: a -> a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The identity function maps any value to itself.
|
||||||
|
|
||||||
|
#### applyN
|
||||||
|
|
||||||
|
Apply a function to a value `n` times.
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
($!!) :: NFData a => (a -> b) -> a -> b
|
applyN :: Int -> (a -> a) -> a -> a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> applyN 25 (+2) 0
|
||||||
|
50
|
||||||
|
|
||||||
|
> applyN 3 (1:) []
|
||||||
|
[1,1,1]
|
||||||
|
```
|
||||||
|
|
||||||
|
Strictness
|
||||||
|
-----------
|
||||||
|
|
||||||
|
#### $!
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
($!) :: NFData a => (a -> b) -> a -> b
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### $!!
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
($!!) :: NFData a => (a -> b) -> a -> b
|
($!!) :: NFData a => (a -> b) -> a -> b
|
||||||
```
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### force
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
force :: NFData a => a -> a
|
force :: NFData a => a -> a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
Functor
|
||||||
|
=======
|
||||||
|
|
||||||
|
#### map
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
map :: Functor f => (a -> b) -> f a -> f b
|
||||||
|
```
|
||||||
|
|
||||||
|
#### $>
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
($>) :: Functor f => f a -> b -> f b
|
||||||
|
```
|
||||||
|
|
||||||
|
#### <$>
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
(<$>) :: Functor f => (a -> b) -> f a -> f b
|
||||||
|
```
|
||||||
|
|
||||||
|
#### <<$>>
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### void
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
void :: Functor f => f a -> f ()
|
||||||
|
```
|
||||||
|
|
||||||
|
#### foreach
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
foreach :: Functor f => f a -> (a -> b) -> f b
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Generics
|
||||||
|
========
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
Hashing
|
||||||
|
=======
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
hashWithSalt :: Hashable a => Int -> a -> Int
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
hash :: Hashable a => a -> Int
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
hashUsing :: Hashable b => (a -> b) -> Int -> a -> Int
|
||||||
|
```
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
Welcome to project documentation.
|
|
||||||
|
|
||||||
- [Printing](Printing.md)
|
|
||||||
- [File Handling](Files.md)
|
|
||||||
- [Strings](Strings.md)
|
|
||||||
- [Functions](Function.md)
|
|
||||||
- [Functors](Applicative.md)
|
|
||||||
- [Monad](Monad.md)
|
|
||||||
- [Maybe](Maybe.md)
|
|
||||||
- [Either](Either.md)
|
|
||||||
- [Booleans](Bool.md)
|
|
||||||
- [Numbers](Numbers.md)
|
|
||||||
- [Monoid](Monoid.md)
|
|
||||||
- [Semigroup](Semigroup.md)
|
|
||||||
- [Bifunctor](Bifunctor.md)
|
|
||||||
- [Lists](List.md)
|
|
||||||
- [Folds](Folds.md)
|
|
||||||
- [Traversals](Traversals.md)
|
|
||||||
- [Transformers](Transformers.md)
|
|
||||||
- [Reader](Reader.md)
|
|
||||||
- [State](State.md)
|
|
||||||
- [Exception Handling](Exceptions.md)
|
|
||||||
- [ST](ST.md)
|
|
||||||
- [Async & Concurrency](Concurrency.md)
|
|
||||||
- [Storable & Bytes](Storable.md)
|
|
||||||
- [System](Systsem.md)
|
|
||||||
- [Dictionaries](Map.md)
|
|
||||||
- [Sets](Set.md)
|
|
||||||
- [Tuples](Tuples.md)
|
|
||||||
- [Generics](Generics.md)
|
|
||||||
- [Type Level Programming](TypeLevel.md)
|
|
||||||
- [Unsafe](Unsafe.md)
|
|
||||||
+68
-14
@@ -1,104 +1,158 @@
|
|||||||
List
|
List
|
||||||
====
|
====
|
||||||
|
|
||||||
#### Slicing
|
Slicing
|
||||||
|
-------
|
||||||
|
|
||||||
|
#### head
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
head :: Foldable f => f a -> Maybe a
|
head :: Foldable f => f a -> Maybe a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### tailMay
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
tailMay :: [a] -> Maybe [a]
|
tailMay :: [a] -> Maybe [a]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### tailSafe
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
tailSafe :: [a] -> [a]
|
tailSafe :: [a] -> [a]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### initMay
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
initMay :: [a] -> Maybe [a]
|
initMay :: [a] -> Maybe [a]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### initSafe
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
initSafe :: [a] -> [a]
|
initSafe :: [a] -> [a]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### initDef
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
initDef :: [a] -> [a] -> [a]
|
initDef :: [a] -> [a] -> [a]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### lastMay
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
lastMay :: [a] -> Maybe a
|
lastMay :: [a] -> Maybe a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### lastDef
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
lastDef :: a -> [a] -> a
|
lastDef :: a -> [a] -> a
|
||||||
```
|
```
|
||||||
|
|
||||||
```haskell
|
#### drop
|
||||||
list :: [b] -> (a -> b) -> [a] -> [b]
|
|
||||||
```
|
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
drop :: Int -> [a] -> [a]
|
drop :: Int -> [a] -> [a]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### take
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
take :: Int -> [a] -> [a]
|
take :: Int -> [a] -> [a]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Unpacking
|
Unpacking
|
||||||
|
---------
|
||||||
|
|
||||||
|
#### uncons
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
uncons :: [a] -> Maybe (a, [a])
|
uncons :: [a] -> Maybe (a, [a])
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### unsnoc
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
unsnoc :: [x] -> Maybe ([x],x)
|
unsnoc :: [x] -> Maybe ([x],x)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Sorting
|
#### list
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
list :: [b] -> (a -> b) -> [a] -> [b]
|
||||||
|
```
|
||||||
|
|
||||||
|
Sorting
|
||||||
|
---------
|
||||||
|
|
||||||
|
#### sortOn
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
sortOn :: Ord o => (a -> o) -> [a] -> [a]
|
sortOn :: Ord o => (a -> o) -> [a] -> [a]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Removing
|
Removing
|
||||||
|
---------
|
||||||
|
|
||||||
|
#### ordNub
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
ordNub :: Ord a => [a] -> [a]
|
ordNub :: Ord a => [a] -> [a]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Splitting
|
Splitting
|
||||||
|
---------
|
||||||
|
|
||||||
|
#### splitAt
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
splitAt :: Int -> [a] -> ([a], [a])
|
splitAt :: Int -> [a] -> ([a], [a])
|
||||||
```
|
```
|
||||||
|
|
||||||
```haskell
|
#### intercalate
|
||||||
splitAt :: Int -> [a] -> ([a], [a])
|
|
||||||
```
|
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
intercalate :: [a] -> [[a]] -> [a]
|
intercalate :: [a] -> [[a]] -> [a]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Comparison
|
Comparison
|
||||||
|
---------
|
||||||
|
|
||||||
|
#### isPrefixOf
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
isPrefixOf :: Eq a => [a] -> [a] -> Bool
|
isPrefixOf :: Eq a => [a] -> [a] -> Bool
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Filter
|
Filtering
|
||||||
|
---------
|
||||||
|
|
||||||
|
#### filter
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
filter :: (a -> Bool) -> [a] -> [a]
|
filter :: (a -> Bool) -> [a] -> [a]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### replicate
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
replicate :: Int -> a -> [a]
|
replicate :: Int -> a -> [a]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Indexing
|
||||||
|
--------
|
||||||
|
|
||||||
|
#### atMay
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
map :: Functor f => (a -> b) -> f a -> f b
|
atMay :: [a] -> Int -> Maybe a
|
||||||
|
```
|
||||||
|
|
||||||
|
#### atDef
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
atDef :: a -> [a] -> Int -> a
|
||||||
```
|
```
|
||||||
|
|||||||
+225
@@ -0,0 +1,225 @@
|
|||||||
|
# Makefile for Sphinx documentation
|
||||||
|
#
|
||||||
|
|
||||||
|
# You can set these variables from the command line.
|
||||||
|
SPHINXOPTS =
|
||||||
|
SPHINXBUILD = sphinx-build
|
||||||
|
PAPER =
|
||||||
|
BUILDDIR = _build
|
||||||
|
|
||||||
|
# Internal variables.
|
||||||
|
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||||
|
PAPEROPT_letter = -D latex_paper_size=letter
|
||||||
|
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||||
|
# the i18n builder cannot share the environment and doctrees with the others
|
||||||
|
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||||
|
|
||||||
|
.PHONY: help
|
||||||
|
help:
|
||||||
|
@echo "Please use \`make <target>' where <target> is one of"
|
||||||
|
@echo " html to make standalone HTML files"
|
||||||
|
@echo " dirhtml to make HTML files named index.html in directories"
|
||||||
|
@echo " singlehtml to make a single large HTML file"
|
||||||
|
@echo " pickle to make pickle files"
|
||||||
|
@echo " json to make JSON files"
|
||||||
|
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||||
|
@echo " qthelp to make HTML files and a qthelp project"
|
||||||
|
@echo " applehelp to make an Apple Help Book"
|
||||||
|
@echo " devhelp to make HTML files and a Devhelp project"
|
||||||
|
@echo " epub to make an epub"
|
||||||
|
@echo " epub3 to make an epub3"
|
||||||
|
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||||
|
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||||
|
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
||||||
|
@echo " text to make text files"
|
||||||
|
@echo " man to make manual pages"
|
||||||
|
@echo " texinfo to make Texinfo files"
|
||||||
|
@echo " info to make Texinfo files and run them through makeinfo"
|
||||||
|
@echo " gettext to make PO message catalogs"
|
||||||
|
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||||
|
@echo " xml to make Docutils-native XML files"
|
||||||
|
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
||||||
|
@echo " linkcheck to check all external links for integrity"
|
||||||
|
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||||
|
@echo " coverage to run coverage check of the documentation (if enabled)"
|
||||||
|
@echo " dummy to check syntax errors of document sources"
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf $(BUILDDIR)/*
|
||||||
|
|
||||||
|
.PHONY: html
|
||||||
|
html:
|
||||||
|
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||||
|
|
||||||
|
.PHONY: dirhtml
|
||||||
|
dirhtml:
|
||||||
|
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||||
|
|
||||||
|
.PHONY: singlehtml
|
||||||
|
singlehtml:
|
||||||
|
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||||
|
|
||||||
|
.PHONY: pickle
|
||||||
|
pickle:
|
||||||
|
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can process the pickle files."
|
||||||
|
|
||||||
|
.PHONY: json
|
||||||
|
json:
|
||||||
|
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can process the JSON files."
|
||||||
|
|
||||||
|
.PHONY: htmlhelp
|
||||||
|
htmlhelp:
|
||||||
|
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||||
|
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||||
|
|
||||||
|
.PHONY: qthelp
|
||||||
|
qthelp:
|
||||||
|
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||||
|
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||||
|
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/protolude.qhcp"
|
||||||
|
@echo "To view the help file:"
|
||||||
|
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/protolude.qhc"
|
||||||
|
|
||||||
|
.PHONY: applehelp
|
||||||
|
applehelp:
|
||||||
|
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
|
||||||
|
@echo "N.B. You won't be able to view it unless you put it in" \
|
||||||
|
"~/Library/Documentation/Help or install it in your application" \
|
||||||
|
"bundle."
|
||||||
|
|
||||||
|
.PHONY: devhelp
|
||||||
|
devhelp:
|
||||||
|
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished."
|
||||||
|
@echo "To view the help file:"
|
||||||
|
@echo "# mkdir -p $$HOME/.local/share/devhelp/protolude"
|
||||||
|
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/protolude"
|
||||||
|
@echo "# devhelp"
|
||||||
|
|
||||||
|
.PHONY: epub
|
||||||
|
epub:
|
||||||
|
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||||
|
|
||||||
|
.PHONY: epub3
|
||||||
|
epub3:
|
||||||
|
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
|
||||||
|
|
||||||
|
.PHONY: latex
|
||||||
|
latex:
|
||||||
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||||
|
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||||
|
"(use \`make latexpdf' here to do that automatically)."
|
||||||
|
|
||||||
|
.PHONY: latexpdf
|
||||||
|
latexpdf:
|
||||||
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||||
|
@echo "Running LaTeX files through pdflatex..."
|
||||||
|
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||||
|
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||||
|
|
||||||
|
.PHONY: latexpdfja
|
||||||
|
latexpdfja:
|
||||||
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||||
|
@echo "Running LaTeX files through platex and dvipdfmx..."
|
||||||
|
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
||||||
|
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||||
|
|
||||||
|
.PHONY: text
|
||||||
|
text:
|
||||||
|
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||||
|
|
||||||
|
.PHONY: man
|
||||||
|
man:
|
||||||
|
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||||
|
|
||||||
|
.PHONY: texinfo
|
||||||
|
texinfo:
|
||||||
|
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||||
|
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||||
|
"(use \`make info' here to do that automatically)."
|
||||||
|
|
||||||
|
.PHONY: info
|
||||||
|
info:
|
||||||
|
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||||
|
@echo "Running Texinfo files through makeinfo..."
|
||||||
|
make -C $(BUILDDIR)/texinfo info
|
||||||
|
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||||
|
|
||||||
|
.PHONY: gettext
|
||||||
|
gettext:
|
||||||
|
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||||
|
|
||||||
|
.PHONY: changes
|
||||||
|
changes:
|
||||||
|
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||||
|
@echo
|
||||||
|
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||||
|
|
||||||
|
.PHONY: linkcheck
|
||||||
|
linkcheck:
|
||||||
|
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||||
|
@echo
|
||||||
|
@echo "Link check complete; look for any errors in the above output " \
|
||||||
|
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||||
|
|
||||||
|
.PHONY: doctest
|
||||||
|
doctest:
|
||||||
|
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||||
|
@echo "Testing of doctests in the sources finished, look at the " \
|
||||||
|
"results in $(BUILDDIR)/doctest/output.txt."
|
||||||
|
|
||||||
|
.PHONY: coverage
|
||||||
|
coverage:
|
||||||
|
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
|
||||||
|
@echo "Testing of coverage in the sources finished, look at the " \
|
||||||
|
"results in $(BUILDDIR)/coverage/python.txt."
|
||||||
|
|
||||||
|
.PHONY: xml
|
||||||
|
xml:
|
||||||
|
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
||||||
|
|
||||||
|
.PHONY: pseudoxml
|
||||||
|
pseudoxml:
|
||||||
|
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
||||||
|
|
||||||
|
.PHONY: dummy
|
||||||
|
dummy:
|
||||||
|
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. Dummy builder generates no files."
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
Maybe
|
||||||
|
=====
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
maybe :: b -> (a -> b) -> Maybe a -> b
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
isJust :: Maybe a -> Bool
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
isNothing :: Maybe a -> Bool
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
fromJust :: Maybe a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
fromMaybe :: a -> Maybe a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
listToMaybe :: [a] -> Maybe a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
maybeToList :: Maybe a -> [a]
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
catMaybes :: [Maybe a] -> [a]
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
mapMaybe :: (a -> Maybe b) -> [a] -> [b]
|
||||||
|
```
|
||||||
+20
-3
@@ -1,14 +1,14 @@
|
|||||||
Monads
|
Monads
|
||||||
======
|
======
|
||||||
|
|
||||||
#### Monad
|
Monad
|
||||||
|
-----
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
class Applicative m => Monad (m :: * -> *) where
|
class Applicative m => Monad (m :: * -> *) where
|
||||||
(>>=) :: m a -> (a -> m b) -> m b
|
(>>=) :: m a -> (a -> m b) -> m b
|
||||||
(>>) :: m a -> m b -> m b
|
(>>) :: m a -> m b -> m b
|
||||||
return :: a -> m a
|
return :: a -> m a
|
||||||
GHC.Base.fail :: GHC.Base.String -> m a
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
@@ -119,7 +119,24 @@ ap :: Monad m => m (a -> b) -> m a -> m b
|
|||||||
(<$!>) :: Monad m => (a -> b) -> m a -> m b
|
(<$!>) :: Monad m => (a -> b) -> m a -> m b
|
||||||
```
|
```
|
||||||
|
|
||||||
#### MonadPlus
|
```haskell
|
||||||
|
whenM :: Monad m => m Bool -> m () -> m ()
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
unlessM :: Monad m => m Bool -> m () -> m ()
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
ifM :: Monad m => m Bool -> m a -> m a -> m a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
guardM :: MonadPlus m => m Bool -> m ()
|
||||||
|
```
|
||||||
|
|
||||||
|
MonadPlus
|
||||||
|
-----
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
class (Alternative m, Monad m) => MonadPlus (m :: * -> *) where
|
class (Alternative m, Monad m) => MonadPlus (m :: * -> *) where
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
Monoid
|
||||||
|
======
|
||||||
|
|
||||||
|
Monoid
|
||||||
|
------
|
||||||
|
|
||||||
|
#### mempty
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
mempty :: Monoid a => a
|
||||||
|
```
|
||||||
|
|
||||||
|
#### <>
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
(<>) :: Monoid m => m -> m -> m
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
mappend :: Monoid a => a -> a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
#### mconcat
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
mconcat :: Monoid a => [a] -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
Semigroup
|
||||||
|
---------
|
||||||
|
|
||||||
|
#### <>
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
(<>) :: Semigroup a => a -> a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
#### sconcat
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
sconcat :: Semigroup a => NonEmpty a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
#### stimes
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
stimes :: (Semigroup a, Integral b) => b -> a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
option :: b -> (a -> b) -> Option a -> b
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
diff :: Semigroup m => m -> Endo m
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
cycle1 :: Semigroup m => m -> m
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
stimesMonoid :: (Integral b, Monoid a) => b -> a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
stimesIdempotent :: Integral b => b -> a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
stimesIdempotentMonoid :: (Integral b, Monoid a) => b -> a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
mtimesDefault :: (Integral b, Monoid a) => b -> a -> a
|
||||||
|
```
|
||||||
|
|
||||||
|
NonEmpty
|
||||||
|
---------
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
Numbers
|
||||||
|
=======
|
||||||
|
|
||||||
|
* Int8
|
||||||
|
* Int16
|
||||||
|
* Int32
|
||||||
|
* Int64
|
||||||
|
* Integer
|
||||||
|
* Word
|
||||||
|
* Word8
|
||||||
|
* Word16
|
||||||
|
* Word32
|
||||||
|
* Word64
|
||||||
|
|
||||||
|
Arithemtic
|
||||||
|
----------
|
||||||
|
|
||||||
|
Trigonometric
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Comparisons
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Ratios
|
||||||
|
------
|
||||||
|
|
||||||
|
Complex Numbers
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Conversions
|
||||||
|
-----------
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Reader
|
||||||
|
======
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ST
|
||||||
|
==
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
State
|
||||||
|
=====
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
Strings
|
||||||
|
=======
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
import qualified Data.Text as T
|
||||||
|
import qualified Data.Text.Lazy as L
|
||||||
|
```
|
||||||
|
|
||||||
|
Text
|
||||||
|
----
|
||||||
|
|
||||||
|
The Text type represents Unicode character strings, in a time and space-efficient manner. This package provides text processing capabilities that are optimized for performance critical use, both in terms of large data quantities and high speed.
|
||||||
|
|
||||||
|
LText
|
||||||
|
-----
|
||||||
|
|
||||||
|
Bytestring
|
||||||
|
----------
|
||||||
|
|
||||||
|
LBytestring
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Encoding
|
||||||
|
----------
|
||||||
|
|
||||||
|
#### encodeUtf8
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
encodeUtf8 :: Text -> ByteString
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> encodeUtf8 "ポケット"
|
||||||
|
"\227\131\157\227\130\177\227\131\131\227\131\136"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### decodeUtf8
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
decodeUtf8 :: ByteString -> Text
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> putStrLn $ decodeUtf8 "\227\131\157\227\130\177\227\131\131\227\131\136"
|
||||||
|
ポケット
|
||||||
|
```
|
||||||
|
|
||||||
|
#### decodeUtf8'
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
decodeUtf8' :: ByteString -> Either UnicodeException Text
|
||||||
|
```
|
||||||
|
|
||||||
|
#### decodeUtf8With
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
decodeUtf8With :: OnDecodeError -> ByteString -> Text
|
||||||
|
```
|
||||||
|
|
||||||
|
Conversion
|
||||||
|
----------
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
class StringConv a b where
|
||||||
|
strConv :: Leniency -> a -> b
|
||||||
|
|
||||||
|
data Leniency = Lenient | Strict
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
toS :: StringConv a b => a -> b
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
toSL :: StringConv a b => a -> b
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
a :: LByteString
|
||||||
|
a = "Einstein"
|
||||||
|
|
||||||
|
b :: Text
|
||||||
|
b = "Feynmann"
|
||||||
|
|
||||||
|
c :: ByteString
|
||||||
|
c = "Schrödinger"
|
||||||
|
|
||||||
|
example1 :: ByteString
|
||||||
|
example1 = toS b
|
||||||
|
|
||||||
|
example2 :: Bool
|
||||||
|
example2 = (a == toS b) && (toS b == c)
|
||||||
|
```
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Transformers
|
||||||
|
============
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Traversals
|
||||||
|
==========
|
||||||
@@ -1,22 +1,76 @@
|
|||||||
Tuples
|
Tuples
|
||||||
======
|
======
|
||||||
|
|
||||||
|
#### fst
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
fst :: (a, b) -> a
|
fst :: (a, b) -> a
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Extract the first component of a pair.
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> fst (1,2)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### snd
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
snd :: (a, b) -> b
|
snd :: (a, b) -> b
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Extract the second component of a pair.
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> snd (1,2)
|
||||||
|
2
|
||||||
|
```
|
||||||
|
|
||||||
|
#### swap
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
swap :: (a, b) -> (b, a)
|
swap :: (a, b) -> (b, a)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Swap the components of a pair.
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> swap (1,2)
|
||||||
|
(2,1)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### curry
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
curry :: ((a, b) -> c) -> a -> b -> c
|
curry :: ((a, b) -> c) -> a -> b -> c
|
||||||
```
|
```
|
||||||
|
|
||||||
|
curry converts an uncurried function to a curried function.
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> curry fst 1 2
|
||||||
|
1
|
||||||
|
```
|
||||||
|
|
||||||
|
#### uncurry
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
uncurry :: (a -> b -> c) -> (a, b) -> c
|
uncurry :: (a -> b -> c) -> (a, b) -> c
|
||||||
```
|
```
|
||||||
|
|
||||||
|
uncurry converts a curried function to a function on pairs.
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
> uncurry (+) (1,2)
|
||||||
|
3
|
||||||
|
```
|
||||||
|
|||||||
@@ -30,6 +30,44 @@ vacuous :: Functor f => f Void -> f a
|
|||||||
data Proxy (t :: k) = Proxy
|
data Proxy (t :: k) = Proxy
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Symbol
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
symbolVal :: KnownSymbol n => proxy n -> String
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
b :: String
|
||||||
|
b = symbolVal (Proxy :: Proxy "foo")
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
someSymbolVal :: String -> SomeSymbol
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
#### Nat
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
natVal :: KnownNat n => proxy n -> Integer
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
a :: Integer
|
||||||
|
a = natVal (Proxy :: Proxy 1)
|
||||||
|
```
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
someNatVal :: Integer -> Maybe SomeNat
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example*:
|
||||||
|
|
||||||
#### Type Equality
|
#### Type Equality
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Unsafe
|
||||||
|
======
|
||||||
+348
@@ -0,0 +1,348 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# protolude documentation build configuration file, created by
|
||||||
|
# sphinx-quickstart on Thu Dec 8 09:08:30 2016.
|
||||||
|
#
|
||||||
|
# This file is execfile()d with the current directory set to its
|
||||||
|
# containing dir.
|
||||||
|
#
|
||||||
|
# Note that not all possible configuration values are present in this
|
||||||
|
# autogenerated file.
|
||||||
|
#
|
||||||
|
# All configuration values have a default; values that are commented out
|
||||||
|
# serve to show the default.
|
||||||
|
|
||||||
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
|
#
|
||||||
|
# import os
|
||||||
|
# import sys
|
||||||
|
# sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
|
import sphinx_rtd_theme
|
||||||
|
from recommonmark.parser import CommonMarkParser
|
||||||
|
|
||||||
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
|
# If your documentation needs a minimal Sphinx version, state it here.
|
||||||
|
#
|
||||||
|
# needs_sphinx = '1.0'
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
|
# ones.
|
||||||
|
extensions = [
|
||||||
|
'sphinx.ext.githubpages',
|
||||||
|
]
|
||||||
|
|
||||||
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
templates_path = ['_templates']
|
||||||
|
|
||||||
|
# The suffix(es) of source filenames.
|
||||||
|
# You can specify multiple suffix as a list of string:
|
||||||
|
#
|
||||||
|
# source_suffix = ['.rst', '.md']
|
||||||
|
|
||||||
|
source_parsers = {
|
||||||
|
'.md': CommonMarkParser,
|
||||||
|
}
|
||||||
|
source_suffix = ['.rst', '.md']
|
||||||
|
|
||||||
|
# The encoding of source files.
|
||||||
|
#
|
||||||
|
# source_encoding = 'utf-8-sig'
|
||||||
|
|
||||||
|
# The master toctree document.
|
||||||
|
master_doc = 'index'
|
||||||
|
|
||||||
|
# General information about the project.
|
||||||
|
project = u'protolude'
|
||||||
|
copyright = u'2016, Stephen Diehl'
|
||||||
|
author = u'Stephen Diehl'
|
||||||
|
|
||||||
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
|
# |version| and |release|, also used in various other places throughout the
|
||||||
|
# built documents.
|
||||||
|
#
|
||||||
|
# The short X.Y version.
|
||||||
|
version = u'0.1.11'
|
||||||
|
# The full version, including alpha/beta/rc tags.
|
||||||
|
release = u'0.1.11'
|
||||||
|
|
||||||
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
|
# for a list of supported languages.
|
||||||
|
#
|
||||||
|
# This is also used if you do content translation via gettext catalogs.
|
||||||
|
# Usually you set "language" from the command line for these cases.
|
||||||
|
language = None
|
||||||
|
|
||||||
|
# There are two options for replacing |today|: either, you set today to some
|
||||||
|
# non-false value, then it is used:
|
||||||
|
#
|
||||||
|
# today = ''
|
||||||
|
#
|
||||||
|
# Else, today_fmt is used as the format for a strftime call.
|
||||||
|
#
|
||||||
|
# today_fmt = '%B %d, %Y'
|
||||||
|
|
||||||
|
# List of patterns, relative to source directory, that match files and
|
||||||
|
# directories to ignore when looking for source files.
|
||||||
|
# This patterns also effect to html_static_path and html_extra_path
|
||||||
|
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
||||||
|
|
||||||
|
# The reST default role (used for this markup: `text`) to use for all
|
||||||
|
# documents.
|
||||||
|
#
|
||||||
|
# default_role = None
|
||||||
|
|
||||||
|
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||||
|
#
|
||||||
|
# add_function_parentheses = True
|
||||||
|
|
||||||
|
# If true, the current module name will be prepended to all description
|
||||||
|
# unit titles (such as .. function::).
|
||||||
|
#
|
||||||
|
# add_module_names = True
|
||||||
|
|
||||||
|
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||||
|
# output. They are ignored by default.
|
||||||
|
#
|
||||||
|
# show_authors = False
|
||||||
|
|
||||||
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
|
pygments_style = 'sphinx'
|
||||||
|
|
||||||
|
# A list of ignored prefixes for module index sorting.
|
||||||
|
# modindex_common_prefix = []
|
||||||
|
|
||||||
|
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||||
|
# keep_warnings = False
|
||||||
|
|
||||||
|
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||||
|
todo_include_todos = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for HTML output ----------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
|
# a list of builtin themes.
|
||||||
|
#
|
||||||
|
html_theme = "sphinx_rtd_theme"
|
||||||
|
|
||||||
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
|
# further. For a list of options available for each theme, see the
|
||||||
|
# documentation.
|
||||||
|
#
|
||||||
|
# html_theme_options = {}
|
||||||
|
|
||||||
|
# Add any paths that contain custom themes here, relative to this directory.
|
||||||
|
# html_theme_path = []
|
||||||
|
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
||||||
|
|
||||||
|
# The name for this set of Sphinx documents.
|
||||||
|
# "<project> v<release> documentation" by default.
|
||||||
|
#
|
||||||
|
# html_title = u'protolude v0.1.11'
|
||||||
|
|
||||||
|
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||||
|
#
|
||||||
|
# html_short_title = None
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top
|
||||||
|
# of the sidebar.
|
||||||
|
#
|
||||||
|
# html_logo = None
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to use as a favicon of
|
||||||
|
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||||
|
# pixels large.
|
||||||
|
#
|
||||||
|
# html_favicon = None
|
||||||
|
|
||||||
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
|
html_static_path = ['_static']
|
||||||
|
|
||||||
|
# Add any extra paths that contain custom files (such as robots.txt or
|
||||||
|
# .htaccess) here, relative to this directory. These files are copied
|
||||||
|
# directly to the root of the documentation.
|
||||||
|
#
|
||||||
|
# html_extra_path = []
|
||||||
|
|
||||||
|
# If not None, a 'Last updated on:' timestamp is inserted at every page
|
||||||
|
# bottom, using the given strftime format.
|
||||||
|
# The empty string is equivalent to '%b %d, %Y'.
|
||||||
|
#
|
||||||
|
# html_last_updated_fmt = None
|
||||||
|
|
||||||
|
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||||
|
# typographically correct entities.
|
||||||
|
#
|
||||||
|
# html_use_smartypants = True
|
||||||
|
|
||||||
|
# Custom sidebar templates, maps document names to template names.
|
||||||
|
#
|
||||||
|
# html_sidebars = {}
|
||||||
|
|
||||||
|
# Additional templates that should be rendered to pages, maps page names to
|
||||||
|
# template names.
|
||||||
|
#
|
||||||
|
# html_additional_pages = {}
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#
|
||||||
|
# html_domain_indices = True
|
||||||
|
|
||||||
|
# If false, no index is generated.
|
||||||
|
#
|
||||||
|
# html_use_index = True
|
||||||
|
|
||||||
|
# If true, the index is split into individual pages for each letter.
|
||||||
|
#
|
||||||
|
# html_split_index = False
|
||||||
|
|
||||||
|
# If true, links to the reST sources are added to the pages.
|
||||||
|
#
|
||||||
|
# html_show_sourcelink = True
|
||||||
|
|
||||||
|
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||||
|
#
|
||||||
|
# html_show_sphinx = True
|
||||||
|
|
||||||
|
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||||
|
#
|
||||||
|
# html_show_copyright = True
|
||||||
|
|
||||||
|
# If true, an OpenSearch description file will be output, and all pages will
|
||||||
|
# contain a <link> tag referring to it. The value of this option must be the
|
||||||
|
# base URL from which the finished HTML is served.
|
||||||
|
#
|
||||||
|
# html_use_opensearch = ''
|
||||||
|
|
||||||
|
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||||
|
# html_file_suffix = None
|
||||||
|
|
||||||
|
# Language to be used for generating the HTML full-text search index.
|
||||||
|
# Sphinx supports the following languages:
|
||||||
|
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
|
||||||
|
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
|
||||||
|
#
|
||||||
|
# html_search_language = 'en'
|
||||||
|
|
||||||
|
# A dictionary with options for the search language support, empty by default.
|
||||||
|
# 'ja' uses this config value.
|
||||||
|
# 'zh' user can custom change `jieba` dictionary path.
|
||||||
|
#
|
||||||
|
# html_search_options = {'type': 'default'}
|
||||||
|
|
||||||
|
# The name of a javascript file (relative to the configuration directory) that
|
||||||
|
# implements a search results scorer. If empty, the default will be used.
|
||||||
|
#
|
||||||
|
# html_search_scorer = 'scorer.js'
|
||||||
|
|
||||||
|
# Output file base name for HTML help builder.
|
||||||
|
htmlhelp_basename = 'protoludedoc'
|
||||||
|
|
||||||
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
|
|
||||||
|
latex_elements = {
|
||||||
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
|
#
|
||||||
|
# 'papersize': 'letterpaper',
|
||||||
|
|
||||||
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
|
#
|
||||||
|
# 'pointsize': '10pt',
|
||||||
|
|
||||||
|
# Additional stuff for the LaTeX preamble.
|
||||||
|
#
|
||||||
|
# 'preamble': '',
|
||||||
|
|
||||||
|
# Latex figure (float) alignment
|
||||||
|
#
|
||||||
|
# 'figure_align': 'htbp',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
# (source start file, target name, title,
|
||||||
|
# author, documentclass [howto, manual, or own class]).
|
||||||
|
latex_documents = [
|
||||||
|
(master_doc, 'protolude.tex', u'protolude Documentation',
|
||||||
|
u'Stephen Diehl', 'manual'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
|
# the title page.
|
||||||
|
#
|
||||||
|
# latex_logo = None
|
||||||
|
|
||||||
|
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||||
|
# not chapters.
|
||||||
|
#
|
||||||
|
# latex_use_parts = False
|
||||||
|
|
||||||
|
# If true, show page references after internal links.
|
||||||
|
#
|
||||||
|
# latex_show_pagerefs = False
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
#
|
||||||
|
# latex_show_urls = False
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
#
|
||||||
|
# latex_appendices = []
|
||||||
|
|
||||||
|
# It false, will not define \strong, \code, itleref, \crossref ... but only
|
||||||
|
# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
|
||||||
|
# packages.
|
||||||
|
#
|
||||||
|
# latex_keep_old_macro_names = True
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#
|
||||||
|
# latex_domain_indices = True
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for manual page output ---------------------------------------
|
||||||
|
|
||||||
|
# One entry per manual page. List of tuples
|
||||||
|
# (source start file, name, description, authors, manual section).
|
||||||
|
man_pages = [
|
||||||
|
(master_doc, 'protolude', u'protolude Documentation',
|
||||||
|
[author], 1)
|
||||||
|
]
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
#
|
||||||
|
# man_show_urls = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for Texinfo output -------------------------------------------
|
||||||
|
|
||||||
|
# Grouping the document tree into Texinfo files. List of tuples
|
||||||
|
# (source start file, target name, title, author,
|
||||||
|
# dir menu entry, description, category)
|
||||||
|
texinfo_documents = [
|
||||||
|
(master_doc, 'protolude', u'protolude Documentation',
|
||||||
|
author, 'protolude', 'One line description of project.',
|
||||||
|
'Miscellaneous'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
#
|
||||||
|
# texinfo_appendices = []
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#
|
||||||
|
# texinfo_domain_indices = True
|
||||||
|
|
||||||
|
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||||
|
#
|
||||||
|
# texinfo_show_urls = 'footnote'
|
||||||
|
|
||||||
|
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||||
|
#
|
||||||
|
# texinfo_no_detailmenu = False
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
Protolude Documentation
|
||||||
|
=======================
|
||||||
|
|
||||||
|
An alternative Prelude.
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 0
|
||||||
|
Function
|
||||||
|
Strings
|
||||||
|
Bool
|
||||||
|
Numbers
|
||||||
|
Printing
|
||||||
|
Files
|
||||||
|
Debug
|
||||||
|
Bits
|
||||||
|
Functor
|
||||||
|
Applicative
|
||||||
|
Monad
|
||||||
|
Maybe
|
||||||
|
Either
|
||||||
|
Monoid
|
||||||
|
Semigroup
|
||||||
|
Bifunctor
|
||||||
|
List
|
||||||
|
Folds
|
||||||
|
Traversals
|
||||||
|
Transformers
|
||||||
|
Reader
|
||||||
|
State
|
||||||
|
Exceptions
|
||||||
|
ST
|
||||||
|
Concurrency
|
||||||
|
Storable
|
||||||
|
System
|
||||||
|
Map
|
||||||
|
Set
|
||||||
|
Tuple
|
||||||
|
Generics
|
||||||
|
Hashing
|
||||||
|
TypeLevel
|
||||||
|
Unsafe
|
||||||
|
|
||||||
|
Indices and tables
|
||||||
|
==================
|
||||||
|
|
||||||
|
* :ref:`genindex`
|
||||||
|
* :ref:`search`
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
name: protolude
|
name: protolude
|
||||||
version: 0.1.11
|
version: 0.2
|
||||||
synopsis: A sensible set of defaults for writing custom Preludes.
|
synopsis: A sensible set of defaults for writing custom Preludes.
|
||||||
description: A sensible set of defaults for writing custom Preludes.
|
description: A sensible set of defaults for writing custom Preludes.
|
||||||
homepage: https://github.com/sdiehl/protolude
|
homepage: https://github.com/sdiehl/protolude
|
||||||
|
|||||||
+8
-4
@@ -6,9 +6,12 @@ module Functor (
|
|||||||
Functor(..),
|
Functor(..),
|
||||||
($>),
|
($>),
|
||||||
(<$>),
|
(<$>),
|
||||||
|
(<<$>>),
|
||||||
void,
|
void,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Data.Function ((.))
|
||||||
|
|
||||||
#if (__GLASGOW_HASKELL__ >= 710)
|
#if (__GLASGOW_HASKELL__ >= 710)
|
||||||
import Data.Functor (
|
import Data.Functor (
|
||||||
Functor(..)
|
Functor(..)
|
||||||
@@ -23,16 +26,17 @@ import Data.Functor (
|
|||||||
)
|
)
|
||||||
|
|
||||||
import Data.Function (flip)
|
import Data.Function (flip)
|
||||||
import Data.Function ((.))
|
|
||||||
|
|
||||||
infixl 4 $>
|
infixl 4 $>
|
||||||
|
|
||||||
($>) :: Functor f => f a -> b -> f b
|
($>) :: Functor f => f a -> b -> f b
|
||||||
($>) = flip (<$)
|
($>) = flip (<$)
|
||||||
|
|
||||||
(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
|
|
||||||
(<<$>>) = fmap . fmap
|
|
||||||
|
|
||||||
void :: Functor f => f a -> f ()
|
void :: Functor f => f a -> f ()
|
||||||
void x = () <$ x
|
void x = () <$ x
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
infixl 4 <<$>>
|
||||||
|
|
||||||
|
(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b)
|
||||||
|
(<<$>>) = fmap . fmap
|
||||||
|
|||||||
+33
-5
@@ -103,6 +103,10 @@ import Data.Functor.Identity as X
|
|||||||
|
|
||||||
#if ( __GLASGOW_HASKELL__ >= 800 )
|
#if ( __GLASGOW_HASKELL__ >= 800 )
|
||||||
import Data.Monoid as X
|
import Data.Monoid as X
|
||||||
|
import Data.List.NonEmpty as X (
|
||||||
|
NonEmpty(..)
|
||||||
|
, nonEmpty
|
||||||
|
)
|
||||||
import Data.Semigroup as X (
|
import Data.Semigroup as X (
|
||||||
Semigroup(sconcat, stimes)
|
Semigroup(sconcat, stimes)
|
||||||
, WrappedMonoid
|
, WrappedMonoid
|
||||||
@@ -201,6 +205,7 @@ import Data.Typeable as X (
|
|||||||
import Data.Type.Coercion as X (
|
import Data.Type.Coercion as X (
|
||||||
Coercion(..)
|
Coercion(..)
|
||||||
, coerceWith
|
, coerceWith
|
||||||
|
, repr
|
||||||
)
|
)
|
||||||
|
|
||||||
import Data.Type.Equality as X (
|
import Data.Type.Equality as X (
|
||||||
@@ -223,7 +228,7 @@ import Data.Void as X (
|
|||||||
import Control.Monad.State as X (
|
import Control.Monad.State as X (
|
||||||
MonadState
|
MonadState
|
||||||
, State
|
, State
|
||||||
, StateT
|
, StateT(StateT)
|
||||||
, put
|
, put
|
||||||
, get
|
, get
|
||||||
, gets
|
, gets
|
||||||
@@ -243,7 +248,7 @@ import Control.Monad.State as X (
|
|||||||
import Control.Monad.Reader as X (
|
import Control.Monad.Reader as X (
|
||||||
MonadReader
|
MonadReader
|
||||||
, Reader
|
, Reader
|
||||||
, ReaderT
|
, ReaderT(ReaderT)
|
||||||
, ask
|
, ask
|
||||||
, asks
|
, asks
|
||||||
, local
|
, local
|
||||||
@@ -255,7 +260,7 @@ import Control.Monad.Reader as X (
|
|||||||
import Control.Monad.Except as X (
|
import Control.Monad.Except as X (
|
||||||
MonadError
|
MonadError
|
||||||
, Except
|
, Except
|
||||||
, ExceptT
|
, ExceptT(ExceptT)
|
||||||
, throwError
|
, throwError
|
||||||
, catchError
|
, catchError
|
||||||
, runExcept
|
, runExcept
|
||||||
@@ -274,7 +279,19 @@ import Data.Bits as X hiding (
|
|||||||
unsafeShiftL
|
unsafeShiftL
|
||||||
, unsafeShiftR
|
, unsafeShiftR
|
||||||
)
|
)
|
||||||
import Data.Word as X
|
import Data.Word as X (
|
||||||
|
Word
|
||||||
|
, Word16
|
||||||
|
, Word32
|
||||||
|
, Word64
|
||||||
|
, Word8
|
||||||
|
#if (__GLASGOW_HASKELL__ >= 710)
|
||||||
|
, byteSwap16
|
||||||
|
, byteSwap32
|
||||||
|
, byteSwap64
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
|
||||||
import Data.Either as X
|
import Data.Either as X
|
||||||
import Data.Complex as X
|
import Data.Complex as X
|
||||||
import Data.Char as X (chr)
|
import Data.Char as X (chr)
|
||||||
@@ -293,6 +310,7 @@ import Data.Function as X (
|
|||||||
-- Genericss
|
-- Genericss
|
||||||
import GHC.Generics as X (
|
import GHC.Generics as X (
|
||||||
Generic(..)
|
Generic(..)
|
||||||
|
, Generic1
|
||||||
, Rep
|
, Rep
|
||||||
, K1(..)
|
, K1(..)
|
||||||
, M1(..)
|
, M1(..)
|
||||||
@@ -341,6 +359,16 @@ import Data.Text.Encoding as X (
|
|||||||
, decodeUtf8With
|
, decodeUtf8With
|
||||||
)
|
)
|
||||||
|
|
||||||
|
import Data.Text.Encoding.Error as X (
|
||||||
|
OnDecodeError
|
||||||
|
, OnError
|
||||||
|
, UnicodeException
|
||||||
|
, lenientDecode
|
||||||
|
, strictDecode
|
||||||
|
, ignore
|
||||||
|
, replace
|
||||||
|
)
|
||||||
|
|
||||||
-- IO
|
-- IO
|
||||||
import System.Exit as X
|
import System.Exit as X
|
||||||
import System.Environment as X (getArgs)
|
import System.Environment as X (getArgs)
|
||||||
@@ -403,7 +431,7 @@ map :: Functor f => (a -> b) -> f a -> f b
|
|||||||
map = fmap
|
map = fmap
|
||||||
|
|
||||||
uncons :: [a] -> Maybe (a, [a])
|
uncons :: [a] -> Maybe (a, [a])
|
||||||
uncons [] = Nothing
|
uncons [] = Nothing
|
||||||
uncons (x:xs) = Just (x, xs)
|
uncons (x:xs) = Just (x, xs)
|
||||||
|
|
||||||
unsnoc :: [x] -> Maybe ([x],x)
|
unsnoc :: [x] -> Maybe ([x],x)
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
resolver: lts-5.10
|
resolver: lts-6.2
|
||||||
packages:
|
packages:
|
||||||
- '.'
|
- '.'
|
||||||
extra-deps:
|
extra-deps:
|
||||||
|
|||||||
Reference in New Issue
Block a user