- Algorithm Design with Haskell
- Beginning Haskell: A Project-Based Approach
- Developing Web Apps with Haskell and Yesod
- Functional Design and Architecture
- Get Programming with Haskell
- Haskell Book
- Haskell Cookbook
- Haskell Data Analysis Cookbook
- Haskell Design Patterns
- Haskell from the Very Beginning
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module Language.HigherRank.Main | |
( Expr(..) | |
, EVar(..) | |
, Type(..) | |
, TVar(..) | |
, TEVar(..) | |
, runInfer | |
) where |
import static java.lang.System.*; | |
import java.util.function.BiFunction; | |
import java.util.function.Function; | |
// Implementation of a pseudo-GADT in Java, translating the examples from | |
// http://www.cs.ox.ac.uk/ralf.hinze/publications/With.pdf | |
// The technique presented below is, in fact, just an encoding of a normal Algebraic Data Type | |
// using a variation of the visitor pattern + the application of the Yoneda lemma to make it | |
// isomorphic to the targeted 'GADT'. |
Standard design patterns in scala recommend the cake pattern to help compose larger programs from smaller ones. Generally, for simple cake layers, this works okay. Boner's article suggests using it to compose repository and service layers and his focus is on DI-type composition. As you abstract more of your IO layers however, you realize that you the cake pattern as described does not abstract easily and usage becomes challenging. As the dependencies mount, you create mixin traits that express those dependence and perhaps they use self-types to ensure they are mixed in correctly.
Then at the end of the world, you have to mix in many different traits to get all the components. In addition, perhaps you have used existential types and now you must have a val/object somewhere (i.e. a well defined path) in order to import the types within the service so you can write your program. Existential
// 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) |
import scala.collection._ | |
import scala.collection.mutable.{ArrayBuffer,ListBuffer, Builder} | |
import scala.collection.generic._ | |
import scala.collection.immutable.VectorBuilder | |
// ================================ CustomTraversable ================================== | |
object CustomTraversable extends TraversableFactory[CustomTraversable] { |
Copyright © 2016-2017 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
I am trying to determine if it is possible to build a Swift dynamic library which is itself composed of one of more private modules, without needing to expose to that fact to outside users. My hope was that I could build the private module as a static library, which would be linked into the primary (dynamic) library. The dylib
could then be deployed together with its swiftmodule
and swiftdoc
and be imported, with the private module and its symbols not being exposed at all.
Unfortunately, what I'm currently observing seems to indicate that the private module's swiftmodule
also has to be available for the primary library to be successfully imported.
This can be reproduced as follows. I have the following directory structure:
./Greeter/Logger/Logger.swift
:
public func log(_ message: String) {
How to inform Eclipse and other Mac applications of the command line PATH
- Update Mac OS X's notion of
PATH
.
$ defaults write ~/.MacOSX/environment PATH "`echo $PATH`"
$ echo "setenv PATH $PATH" | sudo tee /etc/launchd.conf
- Restart Mac OS X.
/* | |
* -------------------------------------------------------------- | |
* "THE BEERWARE LICENSE" (Revision 42): | |
* <[email protected]> wrote this code. As long as you retain | |
* this notice, you can do whatever you want with this stuff. If | |
* we meet someday, and you think this stuff is worth it, you can | |
* buy me a beer in return. Yuriy Pitomets | |
* -------------------------------------------------------------- | |
*/ |