MARK P. JONES
Pacific Software Research Center
Department of Computer Science and Engineering
Oregon Graduate Institute of Science and Technology
| {-# LANGUAGE OverloadedStrings #-} | |
| module Main where | |
| import qualified Data.ByteString.Char8 as BS | |
| import qualified Data.Vector as V | |
| import Data.Word | |
| import Data.Monoid | |
| main :: IO () |
Might be good to alternate topics with practical programming topics, or try to practice what you learn with code.
| -- stack exec --package uniplate --package criterion -- ghc Plate.hs -O | |
| -- ./Plate --output=results.html | |
| {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, UndecidableInstances #-} | |
| {-# LANGUAGE TypeApplications #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# LANGUAGE DefaultSignatures #-} | |
| {-# LANGUAGE ConstraintKinds #-} | |
| {-# LANGUAGE MonoLocalBinds #-} |
| module Main where | |
| main :: IO () | |
| main = print 5 |
| data Expr | |
| = Lit Int | |
| | Add Expr Expr | |
| | Mul Expr Expr | |
| | Div Expr Expr | |
| | Sub Expr Expr | |
| | Neg Expr | |
| deriving (Show, Eq, Generic) | |
| [1 of 2] Compiling Transform ( Transform.hs, Transform.o ) [Optimisation flags changed] | |
| ==================== Tidy Core ==================== | |
| Result size of Tidy Core | |
| = {terms: 353, types: 864, coercions: 374, joins: 0/0} | |
| -- RHS size: {terms: 4, types: 9, coercions: 3, joins: 0/0} | |
| gtransform | |
| gtransform = \ @ a_a1p2 @ struct_a1p3 v_B1 -> v_B1 `cast` <Co:3> |
| -- stack exec --package uniplate --package criterion -- ghc Plate.hs -O2 -ddump-simpl -dsuppress-all > /tmp/Plate-dump.hs | |
| {-# LANGUAGE DeriveGeneric #-} | |
| {-# LANGUAGE LambdaCase #-} | |
| import GHC.Generics | |
| import Transform | |
| data Expr |
| #!/usr/bin/env stack | |
| -- stack --resolver lts-15.7 script --package text --package process | |
| {-# LANGUAGE OverloadedStrings #-} | |
| import Control.Monad | |
| import qualified Data.Text as T | |
| import qualified Data.Text.IO as T | |
| import System.Process |
| #!/bin/bash | |
| if [ ! -f ~/.local/bin/ghc ]; then | |
| echo '#!/bin/bash' > ~/.local/bin/ghc; | |
| echo 'stack exec -- ghc $@' >> ~/.local/bin/ghc; | |
| chmod +x ~/.local/bin/ghc; | |
| echo "~/.local/bin/ghc created." | |
| else | |
| echo "~/.local/bin/ghc already exists." | |
| fi |