Table of Contents
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 Format.Stdout where | |
import Control.Program | |
import qualified Data.Map.Strict as M | |
import Relude | |
output :: Histogram -> IO () | |
output = | |
mapM_ (\(k, v) -> putStrLn $ show k ++ " " ++ replicate (fromIntegral v) '#') . M.assocs |
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
\documentclass{article} | |
\usepackage{amsmath} | |
\begin{document} | |
Five ways to prove $P \implies Q$ | |
\begin{itemize} | |
\item \textbf{Direct Proof}: $P \implies Q$ | |
\item \textbf{Proof by Contrapositive}: $\neg Q \implies \neg P$ |
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 TypeOperators #-} | |
module HsOpTy where | |
import GHC.TypeLits | |
-- brittany-disable-next-binding | |
type Foo = | |
Int : | |
'[] |
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 TypeApplications #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module Test where | |
import Data.Aeson | |
import Data.ByteString.Lazy as BL | |
import Data.Text as T | |
data User = User { name :: Text |
You'll generally want to look at:
- heap
- stack
- gc profiles
Do not get bogged down in microoptimizations before you've assessed any macro optimizations that are available. IO and the choice of algorithm dominate any low level changes you may make. In the end you have to think hard about your code!
Topos> For example, if i see that a particular pure function is taking a long time relative to the rest of the code, and that it's Text, and I'm seeing ARR_WORDS rise linearly in the heap, I probably have a thunk-based memory leak. This is knowledge you build up over time.
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
# stylish-haskell configuration file | |
# ================================== | |
# The stylish-haskell tool is mainly configured by specifying steps. These steps | |
# are a list, so they have an order, and one specific step may appear more than | |
# once (if needed). Each file is processed by these steps in the given order. | |
steps: | |
# Convert some ASCII sequences to their Unicode equivalents. This is disabled | |
# by default. | |
# - unicode_syntax: |
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
#!/bin/bash | |
stack install apply-refact hlint stylish-haskell hasktags hoogle intero hindent ispell | |
brew install ispell | |
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 GeneralisedNewtypeDeriving #-} | |
module Data where | |
type UserName = String | |
data DataResult = DataResult String | |
deriving (Eq, Show) | |
class Monad m => Cache m where |
NewerOlder