Skip to content

Instantly share code, notes, and snippets.

{
packageoverrides = super: let self = super.pkgs; in
{
haskellPackages = super.haskellPackages.override // {
overrides = self: super: {
tasty-hedgehog = self.callPackage /home/isaac/data61/tasty-hedgehog {};
hedgehog = self.callPackage /home/isaac/.config/nixpkgs/hedgehog_0_5.nix {};
};
};
};
class HasIdentifier s a | s -> a where
identifier :: Traversal' s (Identifier a)
instance HasIdentifier (Identifier a) a where
identifier f = f
instance HasIdentifier (Atom a) a where
identifier f (AtomIdentifier a ann) = AtomIdentifier <$> f a <*> pure ann
identifier _ a = pure a
data Context = Regular | Async
data Expr :: Context -> * where
AwaitExpr :: Expr a -> Expr 'Async -- "await" <expr>
IfThenElse:: Expr a -> Expr a -> Expr a -> Expr a -- "if" <expr> "then" <expr> "else" <expr>
...
data Statement :: Context -> * where
ExprStatement :: Expr a -> Statement a
...
data Context = Foo | Bar
data Thing :: Context -> * where
ThingFoo :: Int -> Thing 'Foo
ThingBar :: Bool -> Thing 'Bar
parseThingFoo :: CharParsing m => m (Thing 'Foo)
parseThingBar :: CharParsing m => m (Thing 'Bar)
-- This pattern seems like it would be unwieldy for more type variables or data-kind constructors
[32 of 32] Compiling Language.Python.Parser.IR.Checker ( src/Language/Python/Parser/IR/Checker.hs, dist/build/Language/Python/Parser/IR/Checker.o )
/nix/store/ysa06zk7hz9k4f9l03681vfnnbscp5l5-stdenv/setup: line 883: 10486 Segmentation fault ./Setup build
builder for ‘/nix/store/jkla2x6cwfgd5ldpx7zjlyyzm279x74q-hpython-0.0.1.0.drv’ failed with exit code 139
@LightAndLight
LightAndLight / hpython-ideas.txt
Created September 10, 2017 22:17
Things to use hpython for:
- Checked exceptions
- Linting
- Optimisation
- wat detection
@LightAndLight
LightAndLight / NoDigit.hs
Created September 12, 2017 23:26
Template Haskell for programmer UX
module NoDigit (NoDigit, _NoDigit, mkNoDigit, nodigit) where
newtype NoDigit = NoDigit { _getNoDigit :: String }
-- Succeeds if string does not contain a digit
mkNoDigit :: String -> Maybe NoDigit
mkNoDigit s
| any isDigit s = Nothing
| otherwise = Just $ NoDigit s
data Dict : Constraint -> Type where
data Name : Type -> Type where
data (=>) : Constraint -> Type -> Type where
data Expr : Type -> Type where
Var : Name a -> Expr a
Abs : (Name a -> Expr b) -> Expr (a -> b)
App : Expr (a -> b) -> Expr a -> Expr b
DictAbs : (Dict d -> Expr a) -> Expr (d => a)
DictApp : Expr (d => a) -> Dict d -> Expr a
@LightAndLight
LightAndLight / CMTU.md
Last active September 16, 2017 05:44
CMTU paper translation

Original: http://main.megafoundation.org/Langan_CTMU_092902.pdf

Abstract

[Sentence 1] Science is based on "observation" or "perception" of reality. Because of this, any scientific model of a complex system's evolution requires a supporting theory of reality- of which "perception" itself is the model (called "theory-to-universe mapping").

[Sentence 2] The act of "perception" gives rise to "information", so a theory of "perception" relies on some theory of "information. In addition, this theory of perception must be able to account for itself to be a complete theory of reality.

newtype IndentedLines a = IndentedLines { getLines :: NonEmpty (NonEmpty WhitespaceChar, a) }
data Statement
= FuncDef String [String] (IndentedLines Statement)
| Return Expr
data Expr
= LitInt Int
| FunCall String [Expr]