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
@inproceedings{parmonad, | |
title={{A Monad for Deterministic Parallelism}}, | |
author={Marlow, Simon and Newton, Ryan and Peyton Jones, Simon}, | |
booktitle={ACM SIGPLAN Notices}, | |
volume={46}, | |
number={12}, | |
pages={71--82}, | |
year={2011}, | |
organization={ACM} | |
} |
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 RankNTypes, ImpredicativeTypes #-} | |
-- | Concurrent nondeterministic search. | |
module Find | |
( -- * @Find@ monad | |
Find | |
, runFind | |
, unsafeRunFind | |
, hasResult | |
-- * Basic Searches |
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 KindSignatures #-} | |
{-# LANGUAGE DataKinds #-} | |
module Modular (Modular, modulus) where | |
import GHC.TypeLits | |
-- | Integers, modulo some (type-specified) natural. This forms a | |
-- field if the modulus is a prime. | |
newtype Modular (n :: Nat) = Mod { unMod :: Integer } deriving (Eq, Ord) |
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
-- Because of the type of 'from', 'Coaplicative' must correspond to "non-empty containers", for the usual hand-wavy definition of "container". | |
class Functor f => Coapplicative f where | |
from :: f a -> a | |
separate :: f (Either a b) -> Either (f a) (f b) | |
instance Coapplicative Identity where | |
from (Identity a) = a | |
separate (Identity (Left a)) = Left (Identity a) | |
separate (Identity (Right b)) = Right (Identity 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
module Test where | |
import Data.Maybe | |
a = "hello world" | |
const a b = a | |
id 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
module Test where | |
class Data.Functor.Functor f where | |
fmap :: (a -> b) -> f a -> f b | |
class Data.Functor.Functor f => Control.Applicative.Applicative f | |
where | |
pure :: a -> f 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
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCkI6P8XPkAQ/L7mmZY9EXQfHhmrd2ImYPEqExDUa+3xHJWw2Ha8gJ5EMk36QcTHFwok9dWuvjHk+ZCeodW99euuB6ZIuKjIb5Ru+3ZJvWisykTV32Tl+P1Pgi0BijKo9GFk2HJ3HemR2n0cZXvyEJuUvKwncdPWt6Fsr629gPcT7I6M/HwdXLHt9c7r64GhRCLcthKptUDGhVFls9v0w7ReNFjq81P9NO2SvPPJfGO7aAW96QyQdlF4OdtZyOTBy2Fr0FoHNrOZQ6XtwjnY5K8SZ68J05Fy/rHDt7bO3X2dcROnQTWHBMVSjLYnLlL5xlQBp0fj/VblRkiCuoVduT3 msw504@csteach0 |
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
-- |Default load file for the Mueval plugin. Imports and definitions | |
-- can be added to this file to make them available to evaluated | |
-- expressions. | |
module L where | |
-- Use more generic versions of things | |
import Prelude hiding ( (.), id -- Control.Category | |
, foldr, foldr', foldl, foldl', foldr1, foldl1 | |
, and, or, any, all, sum, product | |
, maximum, maximumBy, minimum, minimumBy |
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 #-} | |
module FizzBuzz where | |
import Data.Typeable | |
data Wrapper where | |
Wrap :: Typeable a => a -> Wrapper | |
instance Show Wrapper where |
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 | |
divisors :: Int -> [Int] | |
divisors n = (1:) $ concat [ nub [x, q] | x <- [2..lim], let (q,r) = quotRem n x, r == 0 ] where | |
lim = floor . sqrt $ fromIntegral n | |
triangles :: [Int] | |
triangles = scanl1 (+) [1..] | |
main = print . head $ filter (\i -> length (divisors i) > 500) triangles |