Skip to content

Instantly share code, notes, and snippets.

View debugging's full-sized avatar
🎯
Focusing

Salman Ahmed debugging

🎯
Focusing
View GitHub Profile
@debugging
debugging / lambdaconf-sums-products.md
Created January 8, 2022 00:00 — forked from jdegoes/lambdaconf-sums-products.md
Exercises for "Sums and Products, Oh My!" — LambdaConf Outpost One Meetup (3/17/2016)

Introduction

A type is a set of values.

Int -- The set of all integer values (that fit into 64 bits)

To say that a term a has type A is to say that a is a member of the set of values represented by A.

@debugging
debugging / types.md
Created January 8, 2022 00:00 — forked from jdegoes/types.md
Fun with Types

Reading & Understanding Types: Exercises to Level Up!

A type is a set of values. A value stores information at runtime in computer memory (such as a certain integer, a certain list of strings, etc.).

Monomorphic Function Types

In many languages, functions are values (Haskell, PureScript, Javascript)! Or at least, you can pretend they are (Scala, Java).

@debugging
debugging / fun-with-functions.md
Created January 8, 2022 00:00 — forked from jdegoes/fun-with-functions.md
Fun with Functions! - Exercises Only

These exercises were part of a LambdaConf Outpost meetup. You may find the instructions here.

  1. Develop a model for boolean values (Bool), which may be either true or false.

    Think: Do you need an if-then-else construct? Why or why not?

    Bonus: Develop a model for eithers (Either), whih can be one thing ("left") or another ("right"), and model a boolean as a partitioning of a set into two disjoint sets.

  2. Develop a model for optional values (Maybe / Option), which are containers that are either empty ("nothing" / "none") or hold a single value ("just" / "some").

@debugging
debugging / fun-functions.md
Created January 8, 2022 00:00 — forked from jdegoes/fun-functions.md
Fun with Functions! - Exercises & Solutions
  1. Develop a model for boolean values (Bool), which may be either true or false.

    Think: Do you need an if-then-else construct? Why or why not?

    Bonus: Develop a model for eithers (Either), whih can be one thing ("left") or another ("right"), and model a boolean as a partitioning of a set into two disjoint sets.

    type Bool = forall a. a -> a -> a
    

_true :: Bool

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

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