- A variable is the combination of a name and a location in memory.
- Initializing a variable tells C what the variable's type is, and sets aside some space for the variable's value
- Then, using the variable causes C to look into that variable's memory address.
- Assigning value to a variable means looking up the address and copying bites there
- Reading a variable means looking up the memory address, reading the bytes, and using the variable's types to interpret the bytes (without the type, there'd be no way to know how to interpret the bytes)
- Types give values
meaning
. The meaning of a char is "a single character". This meaning isn't necessarily part of the language. Instead it's for you to have a mental model of what the program does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Data.Map | |
import Data.Monoid | |
import Data.Bool | |
import Reflex.Dom | |
main :: IO () | |
main = mainWidget $ do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE RecordWildCards #-} | |
module Main where | |
import Data.Fixed (mod') | |
import qualified Data.Text as T | |
import Lucid.Svg | |
import qualified Lucid.Svg as L | |
import qualified Lucid.Svg.Elements as E |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Data.Foldable | |
import qualified Data.Text as T | |
import Lucid.Svg | |
import qualified Lucid.Svg.Attributes as A | |
import qualified Lucid.Svg.Elements as E |
Source | Notes |
---|---|
Wikipedia entry |
|
Keep a changelog |
Examples from hackage
| Package | Notes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified Data.Map as M | |
import XMonad | |
import qualified XMonad as XMonad | |
import XMonad.Hooks.SetWMName | |
import qualified XMonad.StackSet as W | |
myWorkspaces = map show [1..9] | |
myNumRow = [xK_ampersand | |
, xK_bracketleft | |
, xK_braceleft |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Applicative | |
import Control.Concurrent | |
import Control.Error | |
import Control.Monad | |
import Control.Monad.Trans (lift) | |
import qualified Data.ByteString as BS | |
import qualified Data.ByteString.Lazy as BSL | |
import qualified Data.Binary.Get as B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Data.List | |
import Codec.Picture | |
import qualified Data.Vector as V | |
r0 = 50 -- Core thickness | |
rEnd = 200 -- Tape role end thickness (no effect?) | |
thick = 1 -- Thickness of one sheet of tape |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cabal sandbox add-source ../io-streams | |
cabal sandbox add-source ../io-streams-haproxy | |
cabal sandbox add-source ../map-syntax | |
cabal sandbox add-source ../snap-server | |
cabal sandbox add-source ../snap-core | |
cabal sandbox add-source ../xmlhtml | |
cabal sandbox add-source ../snap-loader-static | |
cabal sandbox add-source ../snap-loader-dynamic | |
cabal sandbox add-source ../heist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------------------ | |
readRequestBodyHangIssue :: Test | |
readRequestBodyHangIssue = | |
testCase "readRequestBody doesn't hang" assertReadRqBody | |
where | |
assertReadRqBody = | |
do let hdl = readRequestBody 5000 >>= writeLBS | |
res <- race | |
(threadDelay 1000000) | |
(runHandler Nothing (ST.get "" Map.empty) hdl appInit) |