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
$ for i in (seq 255); sudo ifconfig lo0 alias 127.0.0.$i ; end | |
Password: | |
16:00:16 ~/W/p/a/W/c/numerical (master|✚7…) $ nc -l 0:0:0:0:0:ffff:7f00:50 80 | |
nc: Permission denied | |
16:00:29 ~/W/p/a/W/c/numerical (master|✚7…) $ nc -l 0:0:0:0:0:ffff:7f00:50 8080 | |
^C⏎ 16:00:36 ~/W/p/a/W/c/numericalnc -l 0:0:0:0:0:ffff:7f00:40 8080 | |
GET / HTTP/1.1 | |
Host: [::ffff:7f00:40]:8080 | |
Connection: keep-alive | |
Upgrade-Insecure-Requests: 1 |
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
{-# OPTIONS --experimental-irrelevance #-} | |
module TypeSpec where | |
open import Data.Fin | |
open import Function | |
open import Data.Unit | |
open import Data.Star as Star | |
open import Relation.Nullary as Decidable | |
open import Data.Nat as Nat |
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, CPP, GADTs, FlexibleContexts, ScopedTypeVariables #-} | |
-- | | |
-- Module : System.Random.MWC.Distributions | |
-- Copyright : (c) 2012 Bryan O'Sullivan | |
-- License : BSD3 | |
-- | |
-- Maintainer : [email protected] | |
-- Stability : experimental | |
-- Portability : portable | |
-- |
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
$ ghci | |
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help | |
Prelude> :set -XQuasiQuotes | |
Prelude> :set -XTemplateHaskellQuotes | |
Prelude> [t| forall x . (x -> x) -> x |] | |
<interactive>:3:14: error: | |
Illegal symbol '.' in type | |
Perhaps you intended to use RankNTypes or a similar language | |
extension to enable explicit-forall syntax: forall <tvs>. <type> |
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
> set -xl MACOSX_DEPLOYMENT_TARGET 10.9 | |
> set -xl CC (which gcc-6) | |
> ./configure --with-nm=(xcrun --find nm-classic) ac_cv_func_clock_gettime=no | |
> cp mk/build.mk.sample mk/build.mk | |
# edit build.mk to add the following lines | |
``` | |
# Uncomment the following to force `integer-gmp` to use the in-tree GMP 5.0.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
newtype RandomT m a = RandomT# { unRandomT# :: (SplitMix64 -> m (a , SplitMix64) ) } | |
instance Functor m => Functor (RandomT m) where | |
fmap = \ f (RandomT# mf) -> | |
RandomT# $ \ seed -> | |
fmap (\(a,s) -> (f a, s) ) $ mf seed | |
instance Applicative m => Applicative (RandomT m) where | |
pure = \ x -> RandomT# $ \ s -> pure ( x , s ) | |
(<*>) = \ (RandomT# frmb) (RandomT# rma) -> RandomT# $ \ s -> |
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
/* | |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. | |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
* | |
* This code is free software; you can redistribute it and/or modify it | |
* under the terms of the GNU General Public License version 2 only, as | |
* published by the Free Software Foundation. Oracle designates this | |
* particular file as subject to the "Classpath" exception as provided | |
* by Oracle in the LICENSE file that accompanied this code. | |
* |
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
newtype RandomT m a = RandomT# { unRandomT# :: (SplitMix64 -> (# m a , SplitMix64 #)) } | |
instance Functor m => Functor (RandomT m) where | |
fmap = \ f (RandomT# mf) -> | |
RandomT# $ \ seed -> | |
let (# !ma , !s' #) = mf seed | |
!mb = fmap f ma | |
in (# mb , s' #) | |
instance Applicative m => Applicative (RandomT m) 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
randomIvalInteger :: (RandomGen g, Num a) => (Integer, Integer) -> g -> (a, g) | |
randomIvalInteger (l,h) rng | |
| l > h = randomIvalInteger (h,l) rng | |
| otherwise = case (f 1 0 rng) of (v, rng') -> (fromInteger (l + v `mod` k), rng') | |
where | |
(genlo, genhi) = genRange rng | |
b = fromIntegral genhi - fromIntegral genlo + 1 | |
-- Probabilities of the most likely and least likely result | |
-- will differ at most by a factor of (1 +- 1/q). Assuming the RandomGen |
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
https://phabricator.haskell.org/D2929 |