This code now lives in its own repo https://github.com/snoyberg/kids-haskell-ide
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
#!/usr/bin/env stack | |
-- stack --resolver lts-12.21 script | |
{-# LANGUAGE NoImplicitPrelude #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
import Control.Lens | |
import Control.Monad (replicateM) | |
import System.Random | |
import RIO |
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
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Copy, Clone)] | |
pub struct NoWrap<T>(T); | |
impl std::ops::Add for NoWrap<u8> { | |
type Output = Option<Self>; | |
fn add(self, rhs: Self) -> Self::Output { | |
self.0.checked_add(rhs.0).map(|x| NoWrap(x)) | |
} | |
} |
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
#[derive(Debug)] | |
struct Foo(usize); | |
impl Drop for Foo { | |
fn drop(&mut self) { | |
println!("Dropping: {}", self.0); | |
} | |
} | |
enum MakeArray<T> { |
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
#!/usr/bin/env stack | |
-- stack --resolver lts-12.18 script | |
import Control.Concurrent (threadDelay) | |
import Control.Concurrent.Async (replicateConcurrently_) | |
import Control.Monad (unless) | |
import Data.IORef | |
import System.Random (randomIO) | |
main :: IO () | |
main = 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
Delivered-To: michael@snoyman.com | |
Received: by 2002:a1c:4301:0:0:0:0:0 with SMTP id q1-v6csp1506707wma; | |
Tue, 20 Nov 2018 23:25:41 -0800 (PST) | |
X-Google-Smtp-Source: AJdET5f1C8DMF9m1XRMoX9S1t46F+PobSy/H5EoANnh63qdnxnwjxYEen1PcquvM6EumRechISPJ | |
X-Received: by 2002:ac8:7416:: with SMTP id p22mr4770530qtq.318.1542785141599; | |
Tue, 20 Nov 2018 23:25:41 -0800 (PST) | |
ARC-Seal: i=1; a=rsa-sha256; t=1542785141; cv=none; | |
d=google.com; s=arc-20160816; | |
b=VhI63HEQnO94PvvqvLMYwbJ6WFtWacc0kmRuEiBnHtHm3v8CQlylR/oZ8k/qwM99Hs | |
IaZfxNJ+nTaLYmTvtQQpb0mGOtYfekQV2Tu37M01sH6pT6hMOAMe45K1QtzvxAvVxJE1 |
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 MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} | |
module LabeledContainers | |
( Map | |
, HashMap | |
, Set | |
, Hashable |
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
valid_up_to | |
valid_up_to.exe |
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 url("https://fonts.googleapis.com/css?family=Lato:400,700,400italic"); | |
/*! | |
* bootswatch v3.3.7 | |
* Homepage: http://bootswatch.com | |
* Copyright 2012-2016 Thomas Park | |
* Licensed under MIT | |
* Based on Bootstrap | |
*/ | |
/*! | |
* Bootstrap v3.3.7 (http://getbootstrap.com) |
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
#!/usr/bin/env stack | |
-- stack --resolver lts-11.10 script | |
{-# LANGUAGE NoImplicitPrelude #-} | |
import RIO | |
import Conduit | |
import Control.Concurrent.STM.TBMQueue | |
doesn'tStall | |
:: MonadUnliftIO m | |
=> Int -- ^ number of microseconds |