Skip to content

Commit a5d3f7c

Browse files
committed
Must. Stop. Fiddling.
1 parent 1afe242 commit a5d3f7c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

examples/src/PrismsForSumTypes.purs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ fillRadial :: Fill
6565
fillRadial = RadialGradient Color.white Color.black $ Point 1.0 3.4
6666

6767

68-
6968
{------ Making prisms with Maybe and `prism'` ------}
7069

7170
-- `prism'` (note the apostrophe) takes two functions. One is a data
@@ -78,7 +77,7 @@ solidFocus = prism' constructor focus
7877
constructor = Solid
7978
focus fill = case fill of
8079
Solid color -> Just color
81-
_ -> Nothing
80+
otherCases -> Nothing
8281

8382
-- In real life, you might abbreviate the above to this:
8483

@@ -131,9 +130,6 @@ type LinearInterchange =
131130
, percent :: Percent
132131
}
133132

134-
-- (In real life, you probably wouldn't have to give such a record a
135-
-- type alias.)
136-
137133
-- When making a prism with `prism` (no apostrophe), the "focus"
138134
-- function returns either the selected value (as a `Right`) or the
139135
-- entire argument (as a `Left`).
@@ -146,10 +142,11 @@ linearFocus = prism constructor focus
146142
focus = case _ of
147143
LinearGradient color1 color2 percent ->
148144
Right {color1, color2, percent}
149-
otherFill ->
150-
Left otherFill
145+
otherCases ->
146+
Left otherCases
151147

152-
-- Even though made differently, this `linearFocus` is used the same way:
148+
-- Even though made differently than `solidFocus`, `linearFocus` is
149+
-- used the same way:
153150

154151
l1 :: String
155152
l1 = preview linearFocus fillBlackToWhite # maybe "!" showRecord

0 commit comments

Comments
 (0)