duplicates = multiple editions
A Classical Introduction to Modern Number Theory, Kenneth Ireland Michael Rosen
A Classical Introduction to Modern Number Theory, Kenneth Ireland Michael Rosen
| sealed trait Task[A] { | |
| import Task._ | |
| final def flatMap[B](f: A => Task[B]): Task[B] = Suspend(this, f) | |
| final def map[B](f: A => B): Task[B] = this match { | |
| case Suspend(inner, suspension) => | |
| Suspend(inner, suspension andThen { _ map f }) | |
| case Async(body) => |
| #!/usr/bin/env python | |
| from __future__ import print_function | |
| import json | |
| import logging | |
| from urllib2 import Request, urlopen, URLError, HTTPError | |
| from base64 import b64decode |
| Here's the idea, | |
| You work in tech. You're in the NYC area. | |
| You care about "people" issues. You think the hardest problem in computing is "people". | |
| You are interested in how we work. How to structure work. How to work together. | |
| How to help your colleagues succeed. | |
| And... | |
| There's so much to learn: |
(A book that I might eventually write!)
Gary Bernhardt
I imagine each of these chapters being about 2,000 words, making the whole book about the size of a small novel. For comparison, articles in large papers like the New York Times average about 1,200 words. Each topic gets whatever level of detail I can fit into that space. For simple topics, that's a lot of space: I can probably walk through a very basic, but working, implementation of the IP protocol.
| dependencies: | |
| cache_directories: | |
| - "~/.stack" | |
| pre: | |
| - wget https://github.com/commercialhaskell/stack/releases/download/v0.1.2.0/stack-0.1.2.0-x86_64-linux.gz -O /tmp/stack.gz | |
| - gunzip /tmp/stack.gz && chmod +x /tmp/stack | |
| - sudo mv /tmp/stack /usr/bin/stack | |
| override: | |
| - stack setup | |
| - stack build |
| /* | |
| The MIT License (MIT) | |
| Copyright (c) 2014 | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is |
| // In Haskell, a type that implements the Monad type class has the following functions: | |
| // | |
| // return :: a -> m a | |
| // bind :: m a -> (a -> m b) -> m b | |
| // | |
| // The Monad type classes could have also been implemented as: | |
| // | |
| // return :: a -> m a | |
| // fmap :: (a -> b) -> m a -> m b | |
| // join :: m (m a) -> m a |
| //PLEASE NOTE: Typing actor refs are really hard problem(take a look at the discussions in Akka mailing list regarding this subject). This is no way a complete solution. This will only work if you know all the possible | |
| //messages an actor can handle (that means no become/unbecome business). | |
| package experiment | |
| import akka.actor.{Props, ActorSystem, Actor, ActorRef} | |
| case class TypedActorRef[A](actorRef: ActorRef) extends AnyVal { | |
| def (implicit ev: A <:< B, sender: ActorRef = Actor.noSender) = actorRef ! msg | |
| } |
This is material to go along with a 2014 Boston Haskell talk.
We are going to look at a series of type signatures in Haskell and explore how parametricity (or lack thereof) lets us constrain what a function is allowed to do.
Let's start with a decidedly non-generic function signature. What are the possible implementations of this function which typecheck?
wrangle :: Int -> Int