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
| import Prelude hiding ((++), concat) | |
| import Control.Applicative | |
| import Control.Monad | |
| import Data.Maybe | |
| import Data.Monoid | |
| import System.Random | |
| import qualified Data.IntMap as IM | |
| import Graphics.DrawingCombinators | |
| import qualified Graphics.UI.SDL as SDL | |
| import Graphics.UI.SDL.Keysym |
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 #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE UndecidableInstances #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| module RotateArgs where | |
| data Z = Z | |
| data S n = S n | |
| class RotateArgs n a where |
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
| import Data.List | |
| import System.Environment | |
| {- RE: http://stackoverflow.com/q/6964392/157360 | |
| cam@atomos:~/scraps/SO/euler$ ghc -O2 --make Euler12.hs | |
| cam@atomos:~/scraps/SO/euler$ time ./Euler12 1000 | |
| 842161320 | |
| real 0m12.892s |
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 TypeOperators #-} | |
| module StreamProc where | |
| import Prelude hiding ((.), id, const) | |
| import Control.Category | |
| import Control.Arrow | |
| import Control.Applicative | |
| const :: (Arrow (~>)) => a -> (b ~> a) | |
| const x = arr (\_ -> x) |
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 Main where | |
| import Control.Monad.State | |
| import Data.Map (Map) | |
| import qualified Data.Map as M | |
| import Data.Set (Set) | |
| import qualified Data.Set as S | |
| import Data.List (isPrefixOf, intercalate) | |
| import Data.Char (toLower) |
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
| import Data.Set (Set) | |
| import qualified Data.Set as S | |
| bindSet :: (Ord a, Ord b) => Set a -> (a -> Set b) -> Set b | |
| bindSet s k = S.unions . S.toList $ S.map k s | |
| foldSet :: (Ord a ) => (a -> b -> Set a) -> a -> [b] -> Set a | |
| foldSet _ a [] = S.singleton a | |
| foldSet f a (x:xs) = bindSet (f a x) (\fax -> foldSet f fax xs) |
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
| Sun Jan 1 20:57 2012 Time and Allocation Profiling Report (Final) | |
| Main +RTS -sstderr -p -RTS | |
| total time = 8.30 secs (415 ticks @ 20 ms) | |
| total alloc = 519,870,364 bytes (excludes profiling overheads) | |
| COST CENTRE MODULE %time %alloc | |
| calcRoots Main 74.7 38.7 |
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
| -- Suggested changes for http://codereview.stackexchange.com/q/7623/4949 | |
| module Nim where | |
| import Data.List | |
| import Data.Maybe | |
| import qualified Data.Map as Map | |
| --Domain | |
| --Nim is a mathematical game of strategy |
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 Map | |
| ( RoomId, Connection | |
| , Room(..), Map | |
| , describeRoom | |
| , numberRooms | |
| , generateMap | |
| , Wumpus (..) | |
| ) where | |
| -- use a proper key/value lookup data structure instead of lists |
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 A where | |
| import GHCJS.Types | |
| newtype Foo = Foo (JSRef ()) | |
| foreign import javascript unsafe "" foo :: IO Foo | |
| {- Output: |
OlderNewer