Skip to content

Instantly share code, notes, and snippets.

rotateAroundX :: (Storable a, Floating a) => a -> Tensor a
rotateAroundX a = Tensor 4 4 $ V.fromList m
where m = concat $ Data.List.transpose [
[1, 0, 0, 0],
[0, cos a, -sin a, 0],
[0, sin a, cos a, 0],
[0, 0, 0, 1] ]
ste11 :: StackTraceElement
ste11 = StackTraceElement
{ className = "Main"
, method = "main"
, lineNumber = 12 }
ste12 :: StackTraceElement
ste12 = StackTraceElement
{ className = "Mapper"
instance Ord StackTraceElement where
compare (StackTraceElement x1 y1 z1) (StackTraceElement x2 y2 z2) =
compare x1 x2 `mappend` compare y1 y2 `mappend` compare z1 z2
connectStatement :: String -> State -> Statement -> State
connectStatement name state stmt = case stmt of
AST.Line expr -> connectExpression name expr state
AST.If cond th el -> let s = connectStatement name (connectExpression name state cond) th in case el of
Just ex -> connectExpression name s ex
Nothing -> s
AST.While cond s -> connectStatement name (connectEpxression name state cond) s
AST.Routine ss -> foldl (connectStatement name) state ss
_ ->
let (this, expr) = case stmt of
module Brainfuck
( executeString
) where
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Vector (Vector)
import qualified Data.Vector as Vector
import Control.Monad.Trans.State
import Control.Monad.Trans.Maybe
{-# LANGUAGE TemplateHaskell, FlexibleInstances #-}
module Parsing.AST where
import Test.QuickCheck
import Halt.AST
import Halt.Utility
import Control.Applicative
import Data.Char
import Data.List
import Halt.Printing.Pretty
public static Gen<ConsList<T>> Sequence<T>(this ConsList<Gen<T>> list)
{
if (list.IsNil) return Return(ConsList.Nil<T>());
return list.Head.Bind(t =>
list.Tail.Sequence().Bind(ts =>
Return(ts.Prepend(t))));
}
public static Gen<T> Return<T>(T value) => FromGenerator(rnd => value);
public static Gen<TB> Ap<T, TB>(this Gen<Func<T, TB>> gf, Gen<T> gen) =>
gf.Bind(f => gen.Bind(a => Return(f(a))));
{-# LANGUAGE ScopedTypeVariables, TypeFamilies, GADTs, DataKinds, MultiParamTypeClasses
, FlexibleInstances, FlexibleContexts, PolyKinds #-}
module Main where
import Data.Proxy
import Prelude hiding ((+))
import qualified Prelude
data Nat = Zero | Succ Nat
{-# LANGUAGE TypeFamilies, FlexibleInstances #-}
module Logic where
import Data.Maybe
import Data.Map (Map)
import qualified Data.Map as Map
import Data.List (nub)
data Logic = Logic :& Logic
| Logic :| Logic