Skip to content

Simplified documentation example? #61

@kurt-mueller-osumc

Description

@kurt-mueller-osumc

In the Composition section of the Lenses guide, there's this example:

(* Lens<'a,'b> -> 'a -> 'b *)
let get (g,_) =
    fun a -> g a

(* Lens<'a,'b> -> 'b -> 'a -> 'a *)
let set (_,s) =
    fun b a -> s b a

Could (and should?) this be simplified to:

(* Lens<'a,'b> -> 'a -> 'b *)
let get (g,_) = g

(* Lens<'a,'b> -> 'b -> 'a -> 'a *)
let set (_,s) = s

The latter code snippet is functionally the same as the former. Is there any reason why the first code snippet is used instead of the second? Perhaps I'm missing the point it's trying to make.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions