Module

Data.Lens.Barlow

#Barlow

class Barlow (string :: Symbol) p s t a b | string -> s t a b where

Members

  • barlow :: Proxy string -> Optic p s t a b

    Type-safe lens for zooming into a deeply nested record

    sky = { zodiac: { virgo: { alpha: "Spica" } } }
    view (barlow (key :: _ "zodiac.virgo.alpha")) sky
    -- Spica 
    over (barlow (key :: _ "zodiac.virgo.alpha")) toUpper sky
    -- { zodiac: { virgo: { alpha: "SPICA" } } }
    

Instances

#key

key :: forall k. Proxy k

Just an alias for Proxy to make selection a bit nicer

Modules