This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Control.Applicative | |
| import Data.Bits | |
| import Data.Word | |
| import qualified Data.Map.Lazy as Map | |
| import qualified Text.Parsec as P | |
| type Ident = String | |
| type Signal = Word16 | |
| data Val = VIdent Ident | VNum Signal deriving Show | |
| data Expr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- brainfuck experiment 7 - free functor sums a la https://gist.github.com/avieth/334201aa341d9a00c7fc | |
| {-# LANGUAGE DeriveFunctor #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
| {-# LANGUAGE KindSignatures #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE OverlappingInstances #-} | |
| {-# LANGUAGE RankNTypes #-} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Control.Applicative | |
| import Control.Monad.State | |
| import Foreign | |
| import System.Environment | |
| import Text.Parsec as P | |
| m=modify.flip advancePtr | |
| r=get>>=lift.peek | |
| w x=get>>=lift.flip poke x | |
| a n=r>>=w.(+n) | |
| c x=toEnum$fromEnum x |