- https://www.mpi-sws.org/~rossberg/papers/Rossberg%20-%20Typed%20Open%20Programming.pdf
- http://www.cis.upenn.edu/~bcpierce/courses/629/papers/Saraswat-javabug.html
- https://books.google.ro/books?id=A5ic1MPTvVsC&pg=PA303&lpg=PA303&dq=type+safety+and+linkers&source=bl&ots=PorxgGbx8y&sig=mRUmqqY4bVhrpmXe8xDMHiwXByE&hl=en&sa=X&ved=0CDcQ6AEwBDgKahUKEwio9LzB99zHAhWFCBoKHb6_CJ8#v=onepage&q=%22language-specific%20linkers%22&f=false
- http://glew.org/nglew/papers/mtal.pdf
- http://www.dmst.aueb.gr/dds/pubs/jrnl/1991-SIGPLAN-CType/html/tsl.pdf
- http://lucacardelli.name/Papers/Linking.pdf
- https://upsilon.cc/~zack/research/publications/jfla10-dh-ocaml.pdf
- http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.142.4305&rep=rep1&type=pdf
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
signature TAGGED_ORD = | |
sig | |
type t | |
type a | |
val wrap : int -> t | |
val compare : t * t -> order | |
val asRecord : { wrap : a -> t, compare : t * t -> order } | |
end | |
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
functor Member(Flag : sig type t end) = | |
struct | |
(* Define types and values common to both MemberA and MemberB. *) | |
end | |
(* | |
* MemberA and MemberB differ only in the declaration of Flag, the rest of | |
* the types and values are the same and come from the Member functor. | |
*) | |
structure MemberA = |
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
function required(name) { | |
return process.env[name] || ( | |
console.error('Missing required environment variable:', name), // <-- this | |
process.exit(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
nth :: Int -> [a] -> a | |
nth n xs = | |
let | |
f acc 0 = acc | |
f acc n = acc . tail | |
in | |
head $ foldl f id [0..n] xs |
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
class Expr(object): | |
def accept(self, visitor): | |
method_name = 'visit_{}'.format(self.__class__.__name__.lower()) | |
visit = getattr(visitor, method_name) | |
return visit(self) | |
class Int(Expr): | |
def __init__(self, value): | |
self.value = value |
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 com.twitter.finagle.Http | |
import com.twitter.util.Await | |
import io.finch._ | |
import io.finch.response.EncodeResponse.encodeString | |
import io.finch.circe._ | |
object Main { | |
val hello: Endpoint[String] = | |
get("hello") { |
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
object Main { | |
// libraryDependencies += "com.typesafe.play" %% "play-json" % "2.3.9" | |
import play.api.libs.json._ | |
// Domain objects | |
sealed trait RankedContent | |
case class Tweet(tweet: Int) extends RankedContent | |
case class Link(link: Int) extends RankedContent | |
case class Response(rank: Int, tag: String, rankedcontent: List[RankedContent]) |
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 java.util.Optional; | |
import java.util.function.Function; | |
public class Chain { | |
public static interface Function2<A,B,R> { | |
public R apply(A a, B b); | |
} | |
public static interface Function3<A,B,C,R> { | |
public R apply(A a, B b, C c); |
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
/* | |
* Assume you have a bunch of methods that return `Option` and you want to | |
* produce very precise output about which of those methods returned a `None` | |
* in case of "failure". | |
* | |
* There are a few strategies to doing that. Here are three of them: | |
*/ | |
object Main { | |
def foo: Option[String] = Some("foo") | |
def bar(x: String): Option[String] = None |