Skip to content

Instantly share code, notes, and snippets.

@soupi
soupi / Plate-dump.hs
Last active January 31, 2020 08:36
Plate dump
[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>
@soupi
soupi / generic-transform.hs
Last active January 30, 2020 13:05
implementation of transform using generics
data Expr
= Lit Int
| Add Expr Expr
| Mul Expr Expr
| Div Expr Expr
| Sub Expr Expr
| Neg Expr
deriving (Show, Eq, Generic)
@soupi
soupi / Main.hs
Created June 14, 2019 07:36
stack exec does not find executable after stack build --profile
module Main where
main :: IO ()
main = print 5
@soupi
soupi / Plate.hs
Last active January 30, 2020 22:35
Uniplate.Data vs hand written Lens.Plated vs generic-lens
-- 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 #-}
@soupi
soupi / CS.org
Last active August 22, 2022 20:18
@soupi
soupi / typing.md
Created September 21, 2018 22:18 — forked from chrisdone/typing.md
Typing Haskell in Haskell

Typing Haskell in Haskell

MARK P. JONES

Pacific Software Research Center

Department of Computer Science and Engineering

Oregon Graduate Institute of Science and Technology

@soupi
soupi / Pixels.hs
Created September 1, 2018 11:05
Generate a .ppm file with a pixel image
{-# 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 ()
@soupi
soupi / git.org
Last active June 28, 2022 16:37
Beginners Git Guide

Beginner’s Git

What is Git?

Git is a very popular Version Control system. A version control system is used to manage software projects. It lets you save the state of your code at different stages/versions so that you can have a ‘history’ of it, it let’s you compare changes throughout the history, have remote backups, collaborate with other people, and a lot more.

Other alternatives to git exist: Mercurial, VCS, SVN, TFS, Darcs, and more. But git is by far the most popular one so might as well learn that.

@soupi
soupi / Parser.hs
Created March 10, 2018 13:10
Shin Parser
{-# LANGUAGE OverloadedStrings #-}
module Language.Shin.Parser where
import qualified Data.Map as M
import qualified Data.Vector as V
import qualified Data.Text as T