Hi! We’re Serokell – a company with about 30 Haskellers working on a bunch of blockchain-related projects (like Cardano or TeachMePlease). We are hiring SREs and a Head of IT Operations that can work with Nix (yay Nix!) and know some Haskell. The job is fully remote.
// This example shows how higher-kinded types can be emulated in Swift today. | |
// It acheives correct typing at the cost of some boilerplate, manual lifting and an existential representation. | |
// The technique below was directly inspired by the paper Lightweight Higher-Kinded Polymorphism | |
// by Jeremy Yallop and Leo White found at http://ocamllabs.io/higher/lightweight-higher-kinded-polymorphism.pdf | |
/// `ConstructorTag` represents a type constructor. | |
/// `Argument` represents an argument to the type constructor. | |
struct Apply<ConstructorTag, Argument> { | |
/// An existential containing a value of `Constructor<Argument>` | |
/// Where `Constructor` is the type constructor represented by `ConstructorTag` |
See https://github.com/benshine/Model01-Firmware/blob/master/Model01-Firmware.ino for the current version. |
When it comes to encoding data on the pure λ-calculus (without complex extensions such as ADTs), there are 3 widely used approaches.
The Church Encoding, which represents data structures as their folds. Using Caramel’s syntax, the natural number 3 is, for example. represented as:
0 c0 = (f x -> x)
1 c1 = (f x -> (f x))
2 c2 = (f x -> (f (f x)))
// https://stackoverflow.com/questions/44309520/my-coproduct-encoding-is-ambiguous | |
import io.circe._, io.circe.generic.semiauto._ | |
import io.circe.shapes._, io.circe.syntax._ | |
import shapeless._, shapeless.union._, shapeless.syntax.singleton._ | |
object Main extends App { | |
object model { | |
case class A(a: String) | |
case class B(a: String, i: Int) |
- Лучший, на мой взгляд, источник - Category theory for programmers by Bartosz Milewski. Seattle, Summer 2016 - видео лекции. Additional material at https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/. Версия в pdf: https://github.com/hmemcpy/milewski-ctfp-pdf
- Теория категорий на JavaScript. Часть 1. Категория множеств и Введение в преобразование моделей
- Теория категорий для программистов, Функторы Седьмая глава из серии статей, указаны ссылки на предыдущие статьи.
- От математики к обобщенному программированию Ориг.название From Mathematics to Generic Programming. Авторы Александр Степанов, Дэниэл Э. Роуз.
- Категория Hask о теории категорий в контексте системы типов язы
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module Language.HigherRank.Main | |
( Expr(..) | |
, EVar(..) | |
, Type(..) | |
, TVar(..) | |
, TEVar(..) | |
, runInfer | |
) where |
You may need to override toString
on any recursive or deeply-nested data structure, since IntelliJ will ask the Java Debugger (JDB) to call toString all the time.
This will blow up your memory.
Useful for any number of reasons: testing on a different OS, using lots of memory/cpu resources you don't have locally, etc.
See an Intellij / IDEA guide for background.
Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x
Disclaimer 1: Type classes are great but they are not the right tool for every job. Enjoy some balance and balance to your balance.
Disclaimer 2: I should tidy this up but probably won’t.
Disclaimer 3: Yeah called it, better to be realistic.
Type classes are a language of their own, this is an attempt to document features and give a name to them.