Here's an ADT which is not a GADT, in Haskell:
data Expr = IntExpr Int | BoolExpr Bool
import shapeless.{HList, HNil, ::} | |
import shapeless.ops.hlist.{Selector, Prepend} | |
import shapeless.test.illTyped | |
object TypeLevelBacktrack extends App { | |
/** [[Parent]] / [[Child]] relationship, father side. */ | |
trait FatherOf[Parent, Child] | |
/** [[Parent]] / [[Child]] relationship, mother side */ | |
trait MotherOf[Parent, Child] |
{-# LANGUAGE FlexibleContexts, DeriveFunctor #-} | |
-------------------------------------------------------------------------------- | |
-- It's no secret - Allele Dev enjoys writing Haskell | |
-- | |
-- This is a tiny example of using Free monads + improve. | |
-------------------------------------------------------------------------------- | |
module Control.Teletype where | |
import Control.Monad | |
import Control.Monad.Free |
Below are my build instructions for GnuPG 2.2.10, released on August 30th, 2018. These instructions are built for a headless Ubuntu 18.04 LTS server (and have also been tested on Ubuntu 14.04/16.04).
If you prefer, you may use the below install script to install GnuPG 2.2.x by running the following commands:
curl -OL "https://gist.githubusercontent.com/vt0r/a2f8c0bcb1400131ff51/raw/e0d2011d7b89bfe5b83c3f29f21949fb21354dd9/install-gnupg22.sh" && sudo -H bash ./install-gnupg22.sh
Java 8 introduced lambdas to the Java language. While the design choices differ in many regards from Scala's functions, the underlying mechanics used to represent Java lambdas is flexible enough to be used as a target for the Scala compiler.
Java does not have canonical heirarchy of generic function types (ala scala.FunctionN
), but instead allows a lambda to be used as a shorthand for an anonymous implementation of an Functional Interface
Here's an example of creating a predicate that closes over one value:
// Create a new MergeStrategy for aop.xml files | |
val aopMerge: MergeStrategy = new MergeStrategy { | |
val name = "aopMerge" | |
import scala.xml._ | |
import scala.xml.dtd._ | |
def apply(tempDir: File, path: String, files: Seq[File]): Either[String, Seq[(File, String)]] = { | |
val dt = DocType("aspectj", PublicID("-//AspectJ//DTD//EN", "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"), Nil) | |
val file = MergeStrategy.createMergeTarget(tempDir, path) |
implicit class StringOps(s: String) { | |
val one = { println("one"); "one" } | |
val two = { println("two"); "two" } | |
lazy val three = { println("three"); "value" } | |
} | |
scala> "asdf".three | |
one |
#!/bin/bash | |
function usage () { | |
script=$0 | |
cat <<USAGE | |
Creates scala project structure to be used with sbt | |
Syntax | |
`basename $script` project_name artifact_id |