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
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] ] |
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
ste11 :: StackTraceElement | |
ste11 = StackTraceElement | |
{ className = "Main" | |
, method = "main" | |
, lineNumber = 12 } | |
ste12 :: StackTraceElement | |
ste12 = StackTraceElement | |
{ className = "Mapper" |
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
instance Ord StackTraceElement where | |
compare (StackTraceElement x1 y1 z1) (StackTraceElement x2 y2 z2) = | |
compare x1 x2 `mappend` compare y1 y2 `mappend` compare z1 z2 |
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
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 |
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
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 |
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
{-# 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 |
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
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)))); |
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
{-# 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 |
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
{-# 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 |
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
- |