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 Macro where | |
import SList | |
import Language.Haskell.TH | |
import Language.Haskell.TH.Quote | |
import Data.Generics | |
listToSList :: (Data a) => [a] -> ExpQ | |
listToSList [] = conE 'Nil | |
listToSList xs = do |
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 TypeFamilies, GADTs, EmptyDataDecls, TypeOperators, | |
UndecidableInstances, MultiParamTypeClasses, FunctionalDependencies, | |
ScopedTypeVariables, FlexibleInstances, FlexibleContexts #-} | |
module Dependent where | |
data Z | |
data S a | |
zero :: Z | |
zero = undefined |
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 PackageImports #-} | |
import Text.Parsec | |
import Control.Applicative hiding ((<|>), many) | |
import Control.Monad | |
import Control.Monad.Trans (liftIO) | |
import Control.Monad.State | |
import Data.Word | |
import System.IO | |
import System.Environment |
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
prop_split :: String -> String -> Bool | |
prop_split x xs = xs == intercalate x (split x xs) | |
split :: Eq a => [a] -> [a] -> [[a]] | |
split [] xs = map (:[]) xs | |
split sep [] = [] | |
split sep xs = unfoldr step (Just xs) | |
where | |
step Nothing = Nothing | |
step (Just xs) = flip mplus (Just (xs, Nothing)) $ do |
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 GADTs, TypeFamilies #-} | |
data GExpr a where | |
GInt :: Int -> GExpr Int | |
GPlus :: GExpr Int -> GExpr Int -> GExpr Int | |
GMult :: GExpr Int -> GExpr Int -> GExpr Int | |
GChar :: Char -> GExpr Char | |
GList :: [GExpr a] -> GExpr [a] | |
evalG :: GExpr a -> a |
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 #-} | |
import InfTree | |
main = print $(infTree) |
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
type S f g x = f x (g x) | |
type K a b = a | |
type I a = a | |
num :: S K K Int | |
num = 12 | |
main = print num |
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
#include <stdio.h> | |
#include <stdlib.h> | |
struct llist{ | |
int var; | |
struct llist *next; | |
}; | |
struct llist array_to_llist(int size, int *array) { | |
struct llist hoge[size]; |
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.Arrow | |
import Control.Arrow.CoKleisli | |
import Control.Comonad | |
import Control.Comonad.Reader | |
import Data.Array | |
import Control.Comonad.Pointer | |
import Control.Functor.Extras | |
import Data.Monoid | |
import Control.Comonad.Exponent | |
import Control.Comonad.Stream |
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
TemplateHaskell: 70 | |
DeriveDataTypeable: 41 | |
OverloadedStrings: 40 | |
FlexibleInstances: 37 | |
TypeSynonymInstances: 31 | |
ScopedTypeVariables: 30 | |
TypeOperators: 30 | |
NamedFieldPuns: 26 | |
FlexibleContexts: 25 | |
PackageImports: 25 |