Search Haskell Channel Logs

Sunday, January 29, 2017

#haskell channel featuring lambdabot, reactormonk, ph88_, glguy, geekosaur, Tuplanolla, and 5 others.

geekosaur 2017-01-29 10:46:38
like repeating yourself the way you did in that paste
geekosaur 2017-01-29 10:46:57
TH could probably avoid it but TH has its own price, which is probably not worth it in this case
ph88_ 2017-01-29 10:48:03
geekosaur, this is one of the most ugly things in my code :( https://paste.fedoraproject.org/540413/85726466/
reactormonk 2017-01-29 10:49:39
Where does Lens' come from? https://hackage.haskell.org/package/uri-bytestring-0.2.2.1/docs/URI-ByteString.html#g:7 =>
reactormonk 2017-01-29 10:49:43
https://www.haskell.org/hoogle/?hoogle=Lens%27
reactormonk 2017-01-29 10:49:55
... or rather, how do I look for it.
Tuplanolla 2017-01-29 10:50:07
What does `:i Lens'` say, reactormonk?
glguy 2017-01-29 10:50:32
jadlr: instead of making an instance of a type synonym, you can create a newtype
reactormonk 2017-01-29 10:50:33
not in scope...
Tuplanolla 2017-01-29 10:51:06
I get `type Lens' s a = Lens s s a a -- Defined in 'Lens.Micro.Type'`, but this is probably not the `Lens'` you're looking for, reactormonk.
reactormonk 2017-01-29 10:51:58
> This module also provides analogs to Lens over the various types in this library. These are written in a generic way to avoid a dependency on any particular lens library. You should be able to use these with a number of packages including lens and lens-family-core.
lambdabot 2017-01-29 10:52:00
:1:6: error: parse error on input 'module'
reactormonk 2017-01-29 10:52:46
So they should be usable with either of these?
geekosaur 2017-01-29 10:52:58
http://hackage.haskell.org/package/lens-4.15.1/docs/Control-Lens-Lens.html#t:Lens-39- ?
geekosaur 2017-01-29 10:53:20
(which is the same type Tuplanolla showed)
jadlr 2017-01-29 10:57:53
glguy, how would that newtype look for a list of Integer?
jadlr 2017-01-29 10:59:58
glguy, thanks I think I got it!
AWizzArd 2017-01-29 11:02:03
Is there some kind of pipe/threading operator in Haskell? Like function composition `.`, but the other way around. Not length . take 10 . reverse $ "abcdefghijklmnop" but "abcdefghijklmnop" -> reverse -> take 10 -> length – "Take this string and reverse it. From the output of this take 10 chars, and from that output give me the length.
Koterpillar 2017-01-29 11:02:43
AWizzArd: some libraries define it, but there are disagreements on whether it's a good style to use it
Koterpillar 2017-01-29 11:02:48
:t (&)
lambdabot 2017-01-29 11:02:49
a -> (a -> b) -> b
Koterpillar 2017-01-29 11:03:04
> "abcdef" & reverse & take 3
lambdabot 2017-01-29 11:03:06
"fed"
AWizzArd 2017-01-29 11:03:48
Oki thx. I don't say that this is necessarily good style, was just curious if there is something like this.
geekosaur 2017-01-29 11:03:57
that's actually flipped ($) not flipped (.). reversed function application
Tuplanolla 2017-01-29 11:04:51
We have that too though.
Tuplanolla 2017-01-29 11:04:51
> 0 & (+ 1) >>> (* 2)
lambdabot 2017-01-29 11:04:53
error:
lambdabot 2017-01-29 11:04:53
Precedence parsing error
lambdabot 2017-01-29 11:04:53
cannot mix '&' [infixl 1] and '>>>' [infixr 1] in the same infix exp...
Tuplanolla 2017-01-29 11:05:04
> 0 & ((+ 1) >>> (* 2))
lambdabot 2017-01-29 11:05:07
2
b4ff3r 2017-01-29 11:14:01
/who
eschnett 2017-01-29 11:33:10
Julia uses "|>": x |> y = y x
Tuplanolla 2017-01-29 11:33:33
Elm has something similar as well.