Search Haskell Channel Logs

Saturday, January 28, 2017

#haskell channel featuring lambdabot, Wizek, glguy,

glguy 2017-01-28 15:45:09
You can forget about the IxValue type family for this exercise
glguy 2017-01-28 15:45:49
Your definition for 's' is wrong, too. Once you have the type signature for hmAt correct you should figure out what type 's' should have had
glguy 2017-01-28 15:46:30
Remember that: type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t
glguy 2017-01-28 15:46:45
In this case you won't need such a general type
glguy 2017-01-28 15:46:53
type Lens' s a = Lens s s a a
glguy 2017-01-28 15:47:04
(that is that s=t and a=b)
Wizek 2017-01-28 15:54:17
Hmm. Maybe my confusion also stems from not yet taking the time to understand the type for Lens and Lens'. A part of me wants this to "just work", and take time to learn/appreciate the theoretical elegance later. But alright I'll try to come up with a different type and definition for 's'.
Wizek 2017-01-28 15:55:06
maybe I could also take something simpler as a stepping stone, e.g. redefining `_1`
glguy 2017-01-28 15:57:30
You don't be able to define a lens by guessing at what they do and what their types should be
Wizek 2017-01-28 16:06:31
> let { g = lens fst (\(a,b) c -> (c,b)) } in ((1,2) ^. g, (1,2) & g .~ 3) -- okay, this works, moving on
lambdabot 2017-01-28 16:06:33
(1,(3,2))