Skip to content

Instantly share code, notes, and snippets.

View Heimdell's full-sized avatar
🔨
Right tool for the right job

Андреев Кирилл Heimdell

🔨
Right tool for the right job
  • Ульяновск
View GitHub Profile
.stack-work
module AST where
import Data.Fix
type AST name = Fix (AST_ name)
data AST_ name self
= Var name
| IfMatch (Match name self)
module Type where
import Control.Monad
import Control.Monad.Random
import Control.Monad.Catch
import Control.Monad.State
import Control.Monad.Except
import Control.Unification
import Control.Unification.Types
module Surface exposing (..)
import Dict exposing (..)
import Maybe exposing (..)
type TerrainType
= Water
| Land
let rx = require("rxjs")
let button = (id, rect, text) => {
let events = new rx.Observable()
let onClick = () => events.emit({id, event: "click"})
let element = {type: "button", id, rect, text, onClick, events}
return element
}
@Heimdell
Heimdell / Eval.hs
Last active July 23, 2019 20:43
An implementation of Joy language
module Eval where
import Control.Monad.Reader
import Control.Monad.State
import Control.Monad.Catch
import Data.Map (Map, (!))
import qualified Data.Map as Map
import Data.Foldable

Preface

In this document I will try to design a simple scripting language in informal way and describe why did I choose this or that feature to be present.

Guidelines

The language to be designed must be

  • simple;
  • ortogonal in features (no 2 features should do the same thing);
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
module Mtl where
import Control.Monad.IO.Class
import Control.Monad.Except
import Control.Monad.Reader
@Heimdell
Heimdell / Eval.hs
Last active May 28, 2019 19:20
Lexically (and hyper-statically) scoped concatenative language
{-# LANGUAGE FlexibleContexts #-}
module Eval
( EvalError (..)
, eval
, letrec
) where
import Control.Monad.Catch (Exception)
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
module Instr where
import Prelude hiding (drop)
import Data.Map (Map)
import Data.String