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 GeneralizedNewtypeDeriving #-} | |
import System.Timeout | |
import Control.Monad | |
import Control.Concurrent | |
import Control.Concurrent.MVar | |
send msg = do | |
--dummy stub | |
print msg |
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.Tree | |
import Data.Traversable | |
import Control.Monad.State hiding (mapM) | |
import Prelude hiding (mapM) | |
test :: (Tree Integer, Integer) | |
test = markOrdering (Node undefined [Node undefined [Node undefined []], Node undefined []]) 0 | |
markOrdering :: (Num t1) => Tree t -> t1 -> (Tree t1, t1) |
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.Foldable | |
import Data.Traversable | |
import Data.Monoid | |
import Data.Maybe | |
import Prelude hiding (head, tail) |
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 FlexibleContexts #-} | |
module Main where | |
import Language.Gator hiding (sequence, mapM) | |
import Data.FixedList | |
import qualified Data.FixedList | |
import Control.Applicative | |
import Data.Traversable | |
import Prelude hiding (sequence, mapM) |
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 Main where | |
import Control.Monad | |
import Data.IORef | |
--import Debug.Trace | |
import System.Mem.Weak | |
import qualified Data.Map as M | |
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
class GameTcpSocket : public QTcpSocket | |
{ | |
const int timeout = 2 * 1000; | |
GameTcpSocket(QObject* parent = 0) : QTcpSocket(parent) | |
{ | |
} | |
template<class T> GameTcpSocket& operator<< (T data) | |
{ | |
QByteArray block; |
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 GeneralizedNewtypeDeriving, RankNTypes, RecursiveDo #-} | |
module ContextRefHidden | |
( ContextRef | |
, Context | |
, runContext | |
, newRef | |
, readRef | |
, writeRef | |
, refKey | |
, attempt |
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.State | |
import Data.Word | |
import Data.Bits | |
-- maybe make this an operator? | |
getField :: (Bits a) => a -> a -> a | |
getField value mask = flip evalState (mask, value, 0) $ do | |
sequence $ replicate (bitSize value) (get >>= setMaskBit) | |
(_, _, result) <- get | |
return result |
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 MagicHash, UnboxedTuples, Rank2Types, FlexibleInstances, | |
MultiParamTypeClasses, UndecidableInstances #-} | |
{- | | |
Module : Control.Monad.ST.Trans | |
Copyright : Josef Svenningsson 2008 | |
(c) The University of Glasgow, 1994-2000 | |
License : BSD | |
Maintainer : [email protected] | |
Stability : experimental |
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.Maybe | |
-- The fixed point datatype | |
data Y f = Y (f (Y f)) | |
-- dummy function for illustration | |
maybeToInt :: Maybe a -> Int | |
maybeToInt = length . maybeToList |
OlderNewer