| -- Our goal is to create a type describing a list of events. This is our | |
| -- type-level DSL. | |
| -- We will then use typeclass resolution to "interpret" this type-level DSL | |
| -- into two things: | |
| -- 1. A comma-separated list of events | |
| -- 2. A method that, when given an event name and a payload, will try to parse | |
| -- that event type with the payload. A form of dynamic dispatching | |
| -- | |
| -- To model a list of types we will use tuples. You can imagine the list of | |
| -- types "Int, String, Char" to look like: |
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| {-# LANGUAGE DeriveFunctor #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE OverlappingInstances #-} | |
| module Main where | |
| import Control.Monad.Free |
| namespace Analogy | |
| { | |
| /// <summary> | |
| /// This example shows that a library that needs access to target .NET Standard 1.3 | |
| /// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET | |
| /// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library. | |
| /// </summary>INetCoreApp10 | |
| class Example1 | |
| { | |
| public void Net45Application(INetFramework45 platform) |
| class Application @Inject() (implicit actorSystem: ActorSystem, exec: ExecutionContext) extends Controller { | |
| implicit val materializer = ActorMaterializer() | |
| val Tick = "tick" | |
| class TickActor(queue: SourceQueue[String]) extends Actor { | |
| def receive = { | |
| case Tick => queue.offer("tack") | |
| } |
Should be work with 0.18
Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !
myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))Changes to .NET Core now allow for longer paths for directories. Here's a sample showcasing that.
Note: this sample is running on .NET Core. The easiest way to get going with that is to get the bits, create these files in a directory, and open that directory with Visual Studio Code.
To build and run:
$ dnu restore
| Function GenerateDSC { | |
| $WindowsFeature = Get-WindowsFeature | Where {$PSItem.installed -and $PSItem.name -match 'net-framework'} | % { | |
| @" | |
| WindowsFeature $($PSItem.name) { | |
| Ensure = 'Present' | |
| Name = "$($PSItem.name)" | |
| } |
| Configuration DotNetFrameWork{ | |
| param($TargetMachine) | |
| Node $TargetMachine { | |
| WindowsFeature NET-Framework-Features { | |
| Ensure = 'Present' | |
| Name = "NET-Framework-Features" | |
| } | |