Skip to content

Instantly share code, notes, and snippets.

View isovector's full-sized avatar

Sandy Maguire isovector

View GitHub Profile
@isovector
isovector / coeffects.hs
Created March 19, 2018 18:28
shitty coeffects
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
------------------------------------------------------------------------------
-- | Magic (aka shitty) implementation of coeffects over standard Haskell arrow
-- types.
@isovector
isovector / hsvim.vim
Created April 8, 2018 12:22
haskell vim pragmas
Plug 'junegunn/vim-easy-align'
function! AddHsPragma()
" Add a new HS pragma, and sort the list so it's pretty
let pragma = input("LANGUAGE ")
normal! ms
if match(getline(1), "module") == 0
execute "normal! ggO\<ESC>"
endif
if pragma != ""
@isovector
isovector / gist:c45c85b5bb83e04e902a29c0fcb1fb76
Created May 27, 2018 09:47 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
{-# LANGUAGE LambdaCase #-}
module Simple.Plugin(plugin) where
import Coercion
import Control.Monad (guard, join)
import CoreMonad
import CoreSyn
import Data.Bifunctor (second)
import Data.Foldable (toList)
#! /usr/bin/env bash
set -ex
rm -r /tmp/ebook || echo ""
mkdir /tmp/ebook
cp *.shiatsu /tmp/ebook
cp *.tex /tmp/ebook
cp *.html /tmp/ebook
cp -r .latex-live-snippets/ /tmp/ebook
cd /tmp/ebook
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
module Lib where
*** Core Lint errors : in result of Desugar (before optimization) ***
<no location info>: warning:
[RHS of $dSemigroup_auC6{v}[lid] :: Semigroup{tc 2K}
Int{(w) tc 3u}]
[RHS of $csconcat{v auCm}[lid] :: NonEmpty{tc rA4} Int{(w) tc 3u}
-> Int{(w) tc 3u}]
[RHS of $dSemigroup_auCq{v}[lid] :: Semigroup{tc 2K}
Int{(w) tc 3u}]
[RHS of $dSemigroup_auCq{v}[lid] :: Semigroup{tc 2K}
Int{(w) tc 3u}]
*** Core Lint errors : in result of Desugar (before optimization) ***
<no location info>: warning:
In the expression: $fNum[] $dNum_a2USl
$dNum_a2USl :: Num a_0
[LclId] is out of scope
<no location info>: warning:
In the expression: $fNum[] $dNum_a2USl
Non-function type in function position
Fun type: forall a. Num a => Num [a]
Arg type: Num a_-1
@isovector
isovector / generics.hs
Last active March 14, 2019 19:29
Generic Existentials
data Skolem (s :: Nat) = forall a. Skolem a
unsafeUnskolem :: Skolem n -> a
unsafeUnskolem (Skolem a) = unsafeCoerce a
data Error e (m :: * -> *) a
= Throw e
| forall x. Catch (m x) (e -> m x) (x -> a)
==================== Tidy Core ====================
Result size of Tidy Core
= {terms: 627, types: 1,687, coercions: 398, joins: 1/6}
-- RHS size: {terms: 5, types: 21, coercions: 11, joins: 0/0}
$WUnion
$WUnion = \ @ e_XHpZ @ a_aHpZ dt_aHuO -> Union @~ <Co:11> dt_aHuO