This file contains 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 DataKinds, TypeFamilies, KindSignatures, TypeOperators, | |
GADTs, FlexibleInstances, FlexibleContexts, UndecidableInstances, | |
MultiParamTypeClasses, FunctionalDependencies #-} | |
module HeteroList | |
( HList (HNil, (:::)) | |
, hhead, htail | |
, hinit, hlast | |
, hlength, hnull | |
, hreverse, (+++) |
This file contains 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.Monad | |
import Data.Maybe | |
import qualified Data.Map as Map | |
-- Typen zur Programmbeschreibung | |
data Source = Reg Int | Val Integer deriving (Show, Eq) | |
type Instruction = (Source, Source, Int, Int) | |
type Program = [Instruction] | |
-- Typen für das Runtimesystem |
This file contains 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 QuadTree | |
( Point, Size, Rect(Rect), Item(Item), QuadTree, Quad | |
, empty, insert, delete, filterTree, query, stats | |
) where | |
import qualified Data.List as L | |
import qualified Debug.Trace as Dbg | |
------------------------------------------------------------------------------- | |
-- TYPES |
This file contains 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 java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.ListIterator; | |
import java.util.Map; | |
import java.util.Set; | |
This file contains 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 Prelude hiding ((++)) | |
import qualified Prelude as P | |
class ListLike a where | |
(++) :: a b -> a b -> a b | |
(<:) :: b -> a b -> a b | |
(>:) :: a b -> b -> a b | |
nil :: a b | |
This file contains 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 Data.List | |
import Data.HashMap.Strict (HashMap) | |
import qualified Data.HashMap.Strict as M | |
data Literal = AtomL String | IntL Int | DoubleL Double deriving (Eq) | |
data Term = Functor String [Term] | |
| Atomic Literal | |
| Variable String deriving (Eq) |
This file contains 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.Monad.IO.Class | |
newtype SchadeT m a = SchadeT { runSchade :: m a } | |
type SchadeM = SchadeT IO | |
instance Monad m => Monad (SchadeT m) where | |
return x = SchadeT $ return x | |
m >>= f = SchadeT $ runSchade m >>= (runSchade . f) | |
schade :: MonadIO m => SchadeT m () |
This file contains 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 #-} | |
module DeriveBinary where | |
import Language.Haskell.TH | |
import Language.Haskell.TH.Syntax | |
import Control.Monad | |
import Data.Binary | |
import Data.Int |
This file contains 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
//============================================================================ | |
// Name : FunctionalCPP.cpp | |
// Author : | |
// Version : | |
// Copyright : Your copyright notice | |
// Description : Hello World in C++, Ansi-style | |
//============================================================================ | |
#include <functional> | |
#include <iostream> | |
#include <string> |
This file contains 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 | |
import Data.Conduit | |
import qualified Data.Conduit.List as CL | |
newtype ListT m a = ListT { runListT :: Producer m a } | |
instance (Monad m) => Functor (ListT m) where | |
fmap f (ListT l) = ListT (l $= CL.map f) |
OlderNewer