Skip to content

Instantly share code, notes, and snippets.

View emilypi's full-sized avatar
🥝
hot girl summer

Emily Pillmore emilypi

🥝
hot girl summer
View GitHub Profile
@emilypi
emilypi / Foo.idr
Last active February 17, 2018 04:20
Creating a simple function in Idris for you to play with
module Foo
public export
data Foo = Try Int | Again Int
implementation Show Foo where
show (Try n) = "(Try " ++ (show n) ++ ")"
show (Again n) = "(Again " ++ (show n) ++ ")"
export
@emilypi
emilypi / dotfiles.el
Last active April 7, 2018 00:51
Emacs dotfiles
;; includes
(add-to-list 'load-path "~/.emacs.d/znc.el")
;; Initialize
(package-initialize)
;; global variables
(setq
inhibit-startup-screen t
create-lockfiles nil
@emilypi
emilypi / DatatypesálaCarte.hs
Last active April 2, 2018 04:36
Datatypes a la Carte pt. I
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE RankNTypes #-}
module AlaCarte (
-- newtypes
Expr,
-- types
IntExpr,
AddExpr,
Algebra,
@emilypi
emilypi / Nat.hs
Last active April 20, 2018 20:05
Nat Para + Cata
module Nat (
-- types
Algebra
, Coalgebra
, NatF
-- data
, Fix
, N
, Nat
-- methods
@emilypi
emilypi / RB.hs
Created May 29, 2018 11:33
Interesting Bits from Rotten Bananas pt. I
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
module RB where
data F a
= Lam a (a -> a)
| Pi a (a -> a)
| App a a
@emilypi
emilypi / RB.hs
Created May 29, 2018 15:23
Functor Results
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
module RB where
import Data.Functor.Contravariant
newtype O f g e = Comp { deComp :: f (g e) }
newtype Square f a = Square { unSquare :: f (f a) }
@emilypi
emilypi / haskell.el
Created November 29, 2018 18:36
haskell.el
(use-package haskell-process
:config
(custom-set-variables
'(haskell-process-suggest-remove-import-lines t)
'(haskell-process-auto-import-loaded-modules t)
'(haskell-process-log t)
'(haskell-process-type 'stack-ghci)))
(use-package haskell-interactive-mode
:hook haskell
@emilypi
emilypi / lazy.hs
Created January 9, 2019 21:21
Tony's problem
reverse'' :: Int -> [a] -> [a] -> [a]
reverse'' n [] rs = drop n rs
reverse'' n as rs = h : t
where
h = case as of (a : as) -> head $ reverse'' n as (a : rs)
t = case as of (a : as) -> reverse'' (n + 1) as (a : rs)
reverse' :: [a] -> [a]
reverse' x = reverse'' 0 x []
{-# language RankNTypes #-}
{-# language GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
module Data.Optics where
@emilypi
emilypi / optics.hs
Last active February 26, 2021 13:39
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE GADTs #-}
module Data.Optics where
class Profunctor p where