From 8995aa71f3f846e82ad8f05690ee679e0259eee6 Mon Sep 17 00:00:00 2001 From: Stephen Diehl Date: Sat, 10 Dec 2016 13:28:32 +0000 Subject: [PATCH] bits and files --- docs/Bits.md | 147 ++++++++++++++++++++++++++++++++++++++++++++++ docs/Files.md | 28 +++++++++ docs/Numbers.md | 11 ++++ docs/Strings.md | 8 +++ docs/TypeLevel.md | 36 ++++++++++-- docs/index.rst | 3 +- 6 files changed, 228 insertions(+), 5 deletions(-) create mode 100644 docs/Bits.md create mode 100644 docs/Files.md diff --git a/docs/Bits.md b/docs/Bits.md new file mode 100644 index 000000000..c9c32e97e --- /dev/null +++ b/docs/Bits.md @@ -0,0 +1,147 @@ +Bits +==== + +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*: + +#### complement + +```haskell +complement :: Bits a => a -> a +``` + +*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 +``` + +```haskell +complementBit :: Bits a => a -> Int -> a +``` + +```haskell +testBit :: Bits a => a -> Int -> Bool +``` + + +```haskell +isSigned :: Bits a => a -> Bool +``` + +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 +``` diff --git a/docs/Files.md b/docs/Files.md new file mode 100644 index 000000000..6b887e606 --- /dev/null +++ b/docs/Files.md @@ -0,0 +1,28 @@ +Files +===== + +Basic IO +-------- + +* readFile +* writeFile +* appendFile +* openFile +* withFile + +Console +------- + +* getLine +* getContents +* interact + +File Handles +------------ + +* stdin +* stdout +* stderr +* Handle +* FilePath +* IOMode(..) diff --git a/docs/Numbers.md b/docs/Numbers.md index fcaa14edc..d5de5acb0 100644 --- a/docs/Numbers.md +++ b/docs/Numbers.md @@ -1,2 +1,13 @@ Numbers ======= + +* Int8 +* Int16 +* Int32 +* Int64 +* Integer +* Word +* Word8 +* Word16 +* Word32 +* Word64 diff --git a/docs/Strings.md b/docs/Strings.md index 57ffd8776..699838302 100644 --- a/docs/Strings.md +++ b/docs/Strings.md @@ -20,6 +20,14 @@ Bytestring LBytestring ----------- +Encoding +---------- + +* encodeUtf8 +* decodeUtf8 +* decodeUtf8' +* decodeUtf8With + Conversion ---------- diff --git a/docs/TypeLevel.md b/docs/TypeLevel.md index 7da15d2fc..2ac046872 100644 --- a/docs/TypeLevel.md +++ b/docs/TypeLevel.md @@ -32,13 +32,41 @@ data Proxy (t :: k) = Proxy #### Symbol -* symbolVal -* someSymbolVal +```haskell +symbolVal :: KnownSymbol n => proxy n -> String +``` + +*Example*: + +```haskell +b :: String +b = symbolVal (Proxy :: Proxy "foo") +``` + +```haskell +someSymbolVal :: String -> SomeSymbol +``` + +*Example*: #### Nat -* natVal -* someNatVal +```haskell +natVal :: KnownNat n => proxy n -> Integer +``` + +*Example*: + +```haskell +a :: Integer +a = natVal (Proxy :: Proxy 1) +``` + +```haskell +someNatVal :: Integer -> Maybe SomeNat +``` + +*Example*: #### Type Equality diff --git a/docs/index.rst b/docs/index.rst index 48f8161c2..74f7088dc 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,8 +10,9 @@ An alternative Prelude. Bool Numbers Printing - Debug Files + Debug + Bits Applicative Monad Maybe