bits and files

This commit is contained in:
Stephen Diehl
2016-12-10 13:28:32 +00:00
parent b32c80d0bb
commit 8995aa71f3
6 changed files with 228 additions and 5 deletions
+147
View File
@@ -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
```
+28
View File
@@ -0,0 +1,28 @@
Files
=====
Basic IO
--------
* readFile
* writeFile
* appendFile
* openFile
* withFile
Console
-------
* getLine
* getContents
* interact
File Handles
------------
* stdin
* stdout
* stderr
* Handle
* FilePath
* IOMode(..)
+11
View File
@@ -1,2 +1,13 @@
Numbers
=======
* Int8
* Int16
* Int32
* Int64
* Integer
* Word
* Word8
* Word16
* Word32
* Word64
+8
View File
@@ -20,6 +20,14 @@ Bytestring
LBytestring
-----------
Encoding
----------
* encodeUtf8
* decodeUtf8
* decodeUtf8'
* decodeUtf8With
Conversion
----------
+32 -4
View File
@@ -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
+2 -1
View File
@@ -10,8 +10,9 @@ An alternative Prelude.
Bool
Numbers
Printing
Debug
Files
Debug
Bits
Applicative
Monad
Maybe