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 BangPatterns #-} | |
import Control.Applicative ((<$>)) | |
main = do | |
!s <- getContents | |
putStrLn "Hello, world!" | |
{- | |
--another | |
main = getContents `seq` putStrLn "hoge" | |
-} |
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 BangPatterns #-} | |
import Control.Applicative ((<$>)) | |
import Data.List | |
main = do | |
!s <- foldl1' seq <$> getContents | |
putStrLn "Hello, world!" |
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 Macros where | |
import Language.Haskell.TH | |
import Control.Monad | |
extractFields :: Name -> Q [Dec] | |
extractFields datName = do | |
(VarI name tp dec fixty) <- reify datName | |
let mytype = getMotherTypeName tp | |
(TyConI dec) <- reify mytype |
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
def copy_instance_val(targ) | |
targ.instance_variables.each{|a| instance_variable_set(a, targ.instance_variable_get(a))} | |
end |
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
[18 of 86] Compiling Plugin.Dict.DictLookup ( Plugin/Dict/DictLookup.hs, dist/build/Plugin/Dict/DictLookup.o ) | |
Plugin/Dict/DictLookup.hs:1:0: | |
Warning: Module `Prelude' is deprecated: | |
You are using the old package `base' version 3.x. | |
Future GHC versions will not support base version 3.x. You | |
should update your code to use the new base version 4.x. | |
Plugin/Dict/DictLookup.hs:22:26: | |
Warning: In the use of `handle' |
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.RWS | |
import Data.Graph.Inductive | |
import Prelude hiding (map, lookup) | |
import Data.Map hiding (map) | |
import Data.Maybe (fromJust) | |
import Control.Monad | |
map :: (Functor f) => (a -> b) -> f a -> f b | |
map = fmap |
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 NamedFieldPuns #-} | |
module EasyGrapher (EGGraph(..), EGEdge(..), buildGraph) where | |
import Data.Graph.Inductive hiding(empty) | |
import qualified Data.Graph.Inductive as G | |
import Control.Monad | |
import Data.Map hiding (map, empty) | |
import qualified Data.Map as M | |
import Control.Monad.State | |
import Data.Maybe | |
import Prelude hiding (lookup) |
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, NamedFieldPuns, TupleSections #-} | |
module Quote (gr) where | |
import Language.Haskell.TH | |
import Language.Haskell.TH.Quote | |
import Text.Parsec hiding ((<|>), many, State) | |
import Control.Applicative | |
import EasyGrapher | |
parseGraph :: (Monad m) => (String, Int, Int) -> String -> m (EGGraph String) | |
parseGraph (file, line, col) src = |
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 Data.List | |
tower 1 = (^) | |
tower n | n > 1 = (\a b -> foldr1 (tower (n-1)) $ genericReplicate b a) | |
| otherwise = error "n must be positive" | |
(^^) = tower 2 | |
(^^^) = tower 3 | |
(^^^^) = tower 4 |
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
map(Fun, [X|Xs], [X1|Xs1]) :- | |
!, | |
Pred =.. [Fun, X, X1], | |
Pred, | |
map(Fun, Xs, Xs1). | |
map(Fun, [], []). | |
foldl(Fun, X, [Y|Ys], Z) :- | |
!, | |
Pred =.. [Fun, X, Y, X1], |
OlderNewer