This file contains 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
# read | |
- generic universe of syntax | |
- Type-directed (optimising) compilation https://dl.acm.org/doi/10.1145/249069.231414 | |
- co-effect systems https://www.doc.ic.ac.uk/~dorchard/publ/coeffects-icfp14.pdf | |
- (ornamentation) | |
- (co-de-Bruijn indices) | |
- find more optimisations | |
- Jacco | |
- GHC |
This file contains 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 FlexibleContexts #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE AllowAmbiguousTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE ConstraintKinds #-} | |
{-# LANGUAGE RankNTypes #-} | |
module NamedArguments where |
This file contains 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 Control.Monad.Trans.Maybe | |
import Control.Monad.IO.Class (liftIO) | |
prog x = do | |
print "hi" | |
runMaybeT $ do | |
Right y <- return x | |
liftIO $ print y -- will only be executed if x matched the pattern `Right y` | |
print "bye" |
This file contains 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 ZebraPuzzle (Resident(..), Solution(..), solve) where | |
import Prelude hiding (product, not, and, (&&)) | |
import Data.List (find) | |
import Data.Maybe (fromJust) | |
import Data.Ix (Ix, range) | |
import qualified Data.Array as A | |
import Control.Monad.Trans.State.Lazy (StateT) | |
import System.IO.Unsafe (unsafePerformIO) |
This file contains 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
mheinzel@mh-tp-ubu:~/projects/haskellbook-berlin/session-notes/Marathon/gloss-demo$ stack repl | |
Warning: File listed in gloss-demo.cabal file does not exist: README.md | |
Warning: File listed in gloss-demo.cabal file does not exist: README.md | |
gloss-demo-0.1.0.0: configure (lib + exe) | |
Configuring gloss-demo-0.1.0.0... | |
gloss-demo-0.1.0.0: initial-build-steps (lib + exe) | |
Warning: File listed in gloss-demo.cabal file does not exist: README.md | |
The following GHC options are incompatible with GHCi and have not been passed to it: -threaded | |
Configuring GHCi with the following packages: gloss-demo | |
Using main module: 1. Package `gloss-demo' component exe:gloss-demo-exe with main-is file: /home/shared/projects/haskellbook-berlin/session-notes/Marathon/gloss-demo/app/Main.hs |
This file contains 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.Strict as M | |
import Data.Map.Strict (Map) | |
import Data.Tuple (swap) | |
import Data.List | |
-- task: map each element to how often it already occured before | |
-- count "abbcccghabc" -> [1,1,2,1,2,3,1,1,2,3,4] | |
-- useful helper function: |
This file contains 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 InstanceSigs #-} | |
{-# LANGUAGE TypeOperators #-} | |
-- First, a simple Reader Monad | |
newtype Reader r a = Reader { runReader :: (r -> a) } | |
instance Functor (Reader r) where | |
fmap :: (a -> b) -> Reader r a -> Reader r b | |
fmap f (Reader g) = Reader (f . g) |
This file contains 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
---------------------------------------------------------------------------- | |
-- Test für die Funktion botListAllMoves :: String -> String -> [String] | |
-- | |
-- Lizenz: MIT | |
-- Berlin, 25.01.2016 | |
---------------------------------------------------------------------------- | |
import Data.List (sort) | |
import ChessBot (botListAllMoves) |