Skip to content

Instantly share code, notes, and snippets.

💭
Functional Programmer for hire. F#, Scala, Kotlin. For web, mobile, cloud etc.

Kunjan Dalal kunjee17

💭
Functional Programmer for hire. F#, Scala, Kotlin. For web, mobile, cloud etc.
Block or report user

Report or block kunjee17

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View shades-of-fsharp-fplus-validation.fs
open System
open FSharpPlus
open FSharpPlus.Data
module Person=
type Name = { unName : String }
with static member create s={unName=s}
type Email = { unEmail : String }
with static member create s={unEmail=s}
type Age = { unAge : int }
View shades-of-fsharp-email-type.fs
type Email private (email : string) =
member __.Email = email
static member create(email : string ) =
// Some validation on email
Email (email)
View shades-of-fsharp-email-module.fs
type Email = private | Email of string
module Email =
let create(email : string ) =
// Some validation on email
Email email
let value (Email email) = email
View shades-of-fsharp-person-trimmed.fs
type Person = {
FirstName : string
LastName : string
}
with
member x.FullName() =
x.FirstName + " " + x.LastName
View shades-of-fsharp-person.fs
type Person(firstName:string, lastName: string) =
let firstName = firstName
let lastName = lastName
let calculateFullName() =
firstName + " " + lastName
member x.FirstName with get() = firstName
member x.LastName with get() = lastName
member x.FullName with get() = calculateFullName()
View shades-of-fsharp-person.cs
class Person {
private readonly string firstName;
private readonly string lastName;
public Person(string firstName, string lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public string FirstName { get {return this.firstName; } }
public string LastName { get {return this.lastName; } }
@kunjee17
kunjee17 / shades-of-fsharp-world-bank.fs
Last active Oct 28, 2019
Famous World Bank Example
View shades-of-fsharp-world-bank.fs
#r "../../../bin/lib/net45/FSharp.Data.dll"
#load "../../../packages/test/FSharp.Charting/FSharp.Charting.fsx"
open FSharp.Data
open FSharp.Charting
type WorldBank = WorldBankDataProvider<"World Development Indicators", Asynchronous=true>
let wb = WorldBank.GetDataContext()
View the-coming-of-age-of-angular-component.css
.flex-container {
display: flex;
flex-wrap: nowrap;
background-color: DodgerBlue;
}
.flex-container > div {
background-color: #f1f1f1;
width: 100px;
margin: 10px;
View the-coming-of-age-of-angular-component.html
<h1>{{title}}</h1>
<h2>My favorite hero is: {{myHero.name}}</h2>
<p>Heroes:</p>
<ul>
<li *ngFor="let hero of heroes">
{{ hero.name }}
</li>
</ul>
<p *ngIf="heroes.length > 3">There are many heroes!</p>
View the-coming-of-age-of-angular-component.ts
import { Component } from '@angular/core';
import { Hero } from './hero';
@Component({
selector: 'app-root',
templateUrl: './Component.html',
styleUrls : ['./Component.css']
})
export class AppComponent {
You can’t perform that action at this time.