This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Let's just use the simplest monad, Identity | |
| import { Identity } from 'wherever'; | |
| // These are our new elements | |
| const f = x => Identity(x + 1); | |
| const g = x => Identity(x + 2); | |
| const h = x => Identity(x + 3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // These are our elements | |
| const f = x => x + 1; | |
| const g = x => x + 2; | |
| const h = x => x + 3; | |
| // This is our neutral element, a function which does nothing | |
| const id = x => x; | |
| // This is the composition | |
| f(g(h(1))) // 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { NgModule, ModuleWithProviders, InjectionToken, Inject, Injector } from '@angular/core'; | |
| import { CommonModule } from '@angular/common'; | |
| export const INSTANTIATED_SERVICES = new InjectionToken<any[]>('instantiated services'); | |
| /** | |
| * This module takes an array of services | |
| * and instantiates them for you. They'll be | |
| * singletons for the injector of the importing module. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * This interceptor ensures that the app makes requests | |
| * with relative paths correctly server-side. | |
| * Requests which start with a dot (ex. ./assets/...) | |
| * or relative ones ( ex. /assets/...) will be converted | |
| * to absolute paths | |
| */ | |
| import { Inject, Injectable, Injector, PLATFORM_ID } from '@angular/core'; | |
| import { isPlatformServer } from '@angular/common'; | |
| import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http'; |
NewerOlder