Types and Programming Languages
Purely Functional Data Structures
Introduction to Algorithms (OK to skim through first 2 chapters)
Study source of containers and unordered-containers
| <Player>: | |
| canvas: | |
| Rectangle: | |
| pos: root.center | |
| size: 40, 40 | |
| <Screen>: | |
| Player |
| *Main> main | |
| > NICK tob | |
| > USER tob 0 * :tob | |
| :irc.codetalk.io NOTICE AUTH :*** Looking up your hostname... | |
| failed to parse | |
| :irc.codetalk.io NOTICE AUTH :*** Couldn't resolve your hostname; using your IP address instead | |
| failed to parse | |
| PING :D433C6EE | |
| failed to parse | |
| ^CInterrupted. |
| Note to self: possible to write a Lisp-like DSL within Haskell using Writer monad? | |
| main = runLisp $ do | |
| def "f" $ do | |
| args $ do | |
| "x" | |
| "y" | |
| body $ do | |
| "x" + "y" | |
| lispPrint $ "f" $ do |
Types and Programming Languages
Purely Functional Data Structures
Introduction to Algorithms (OK to skim through first 2 chapters)
Study source of containers and unordered-containers
| params :: Parser Params | |
| params = do | |
| ps <- takeWhile (notInClass ":\r") `sepBy` space |
| %{ | |
| #define YYSTYPE double /* data type of yacc stack */ | |
| %} | |
| %token NUMBER | |
| %left '+' '-' /* left associative, same precedence */ | |
| %left '*' '/' /* left assoc., higher precedence */ | |
| %left UNARYMINUS | |
| %% | |
| list: /* nothing */ | |
| | list '\n' |
| {-# LANGUAGE OverloadedStrings #-} | |
| module Tob.Parser where | |
| -- (maybe ':') (maybe adress) (command) (params) (maybe ':') (maybe stuff) | |
| import Prelude hiding (takeWhile) | |
| import Control.Applicative ((<|>)) | |
| import Data.Text (Text) | |
| import Data.Char (isUpper) | |
| import Data.Attoparsec.Text |
pipe inp s = inp >>= \x -> sh $ T.concat ["echo ", "\"", x, "\"", " | ", s]DotHellRC.hs:37:33:
Couldn't match expected type `Data.Text.Lazy.Internal.Text'
with actual type `T.Text'
In the return type of a call of `T.concat'
In the second argument of `($)', namely
| {-# LANGUAGE RecordWildCards, OverloadedStrings #-} | |
| import Prelude hiding (Either(..)) | |
| import Data.IntMap (IntMap) | |
| import qualified Data.IntMap as IM | |
| import System.IO (Handle) | |
| import Network (withSocketsDo, listenOn, accept, PortID(..)) | |
| import qualified Data.ByteString.Lazy as B | |
| import Data.Aeson | |
| import Control.Applicative |
| {-# LANGUAGE RecordWildCards #-} | |
| import Prelude hiding (Either(..)) | |
| import Data.IntMap (IntMap) | |
| import qualified Data.IntMap as IM | |
| import System.IO (Handle) | |
| import Network (withSocketsDo, listenOn, accept, PortID(..)) | |
| import qualified Data.ByteString as B | |
| import Data.Aeson |