The snippet demonstrates how to write a general power function that has correct type involving units-of-measure. The function uses numbers represented using types. The snippet is mainly an example of what can be done (not recommended for the real world).
5 people like thisPosted: 13 years ago by Tomas Petricek
OCaml original here : http://eigenclass.org/R2/writings/heterogeneous-containers-in-ocaml
9 people like thisPosted: 13 years ago by Ademar Gonzalez
A compositional type system built using generics and monads in F#. It is only a very limited, _toy_ project exploring traits, mixins and aspect-oriented programming.
17 people like thisPosted: 12 years ago by Zach Bray
Extended from: http://www.fssnip.net/d2
1 people like thisPosted: 10 years ago by Rick Minerich
Simple type arithmetic with Peano numbers, using a recursive type and pattern matching over it.
1 people like thisPosted: 9 years ago by Giacomo Stelluti Scala
Using phantom types to emulate simple dependent types and sized list. Inspired by: https://www.seas.upenn.edu/~sweirich/cis670/09/
6 people like thisPosted: 4 years ago by Vankata
Implements a type into which any other type can be embedded. Check out this link for a discussion: http://ocaml.janestreet.com/?q=node/18
8 people like thisPosted: 13 years ago by Ademar Gonzalez
Here we define Peano arithmetic using F# abstract data types.
5 people like thisPosted: 13 years ago by Daniil
Tired of confusing dictionary instances with different comparers (I am)? Stick it in the type, à la ocaml-core maps.
4 people like thisPosted: 10 years ago by Mauricio Scheffer
This is just the ML code from http://jozefg.bitbucket.org/posts/2015-02-28-type-inference.html ported to F#.
3 people like thisPosted: 9 years ago by Rick Minerich
The snippet shows a minimal example of phantom types for type-safe way of tracking different types of IDs in a simple system.
7 people like thisPosted: 5 years ago by Tomas Petricek