Search Haskell Channel Logs

Friday, March 3, 2017

#haskell channel featuring meijiJAPAN, coltfred, fendor, tabaqui1, mauke, nbro, and 15 others.

tabaqui1 2017-03-03 04:47:02
I hope there is more elegant solution
mauke 2017-03-03 04:47:09
@where configurations
lambdabot 2017-03-03 04:47:10
http://okmij.org/ftp/Haskell/dependent-types.html#Prepose
mauke 2017-03-03 04:47:21
@where reflection
lambdabot 2017-03-03 04:47:22
I know nothing about reflection.
Sornaensis 2017-03-03 04:47:29
is anyone ever going to fix the syntax highlighting bugs in the haskell wiki
liste 2017-03-03 04:47:35
@hackage reflection
mauke 2017-03-03 04:47:36
@where+ reflection http://hackage.haskell.org/package/reflection
lambdabot 2017-03-03 04:47:36
http://hackage.haskell.org/package/reflection
lambdabot 2017-03-03 04:47:36
Good to know.
nbro 2017-03-03 04:52:35
I'm curious to know what Haskell programmers that have at least some experience with Scala think about this latter?
maerwald 2017-03-03 04:52:51
nothing
maerwald 2017-03-03 04:53:18
it's an incredibly unfocussed language and not really functional for a haskeller
bollu 2017-03-03 04:53:26
lens question: is there a way to simplify this? I have two (Data.Map x y), call them "m1" and "m2". I want to extract the key out of m1. if it does not exist, I want to take it out of m2. Best I could come up with way m1 ^. key <|> m2 ^. key
nbro 2017-03-03 04:55:11
maerwald: you mean that it supports different paradigms as opposed to Haskell
nbro 2017-03-03 04:55:17
?!
lambdabot 2017-03-03 04:55:17
Maybe you meant: v @ ? .
maerwald 2017-03-03 04:55:18
no, it's unfocusses
maerwald 2017-03-03 04:55:39
e.g. try to write a proper ADT in Scala... there are 5-10 ways to do it and all are different and have oddities
berndl 2017-03-03 04:55:42
I think Haskellers will all prefer Haskell over Scala any day.
maerwald 2017-03-03 04:55:52
and ultimately, all of them are not what you want
maerwald 2017-03-03 04:56:06
the Scala developers keep adding stuff to the language without much thought
maerwald 2017-03-03 04:56:09
it's like C++
Sornaensis 2017-03-03 04:56:26
yea my problem with scala/c++ is how many divergent ways of doing things there are
berndl 2017-03-03 04:56:36
maerwald: yes, indeed.
Sornaensis 2017-03-03 04:56:51
makes understanding what's happening in a piece of code take longer than necessary
nbro 2017-03-03 04:56:51
oh, I see, I also like languages that are more focused, like Haskell or C
berndl 2017-03-03 04:57:07
How many ways can you define a int variable with a value of 27 in C++?
nbro 2017-03-03 04:57:15
lol
mlev 2017-03-03 04:57:15
Can someone please help me with this memoization within an instance declaration question? http://stackoverflow.com/questions/42583263/memoization-of-intermediate-values-in-a-typeclass-instance
berndl 2017-03-03 04:57:30
There are 6 ways of doing it.
nbro 2017-03-03 04:57:48
but I think this problem comes from the fact that people in those programming languages come from different areas and require different things
Sornaensis 2017-03-03 04:57:50
berndl: only 6?
berndl 2017-03-03 04:58:00
Last I counted, yes.
mauke 2017-03-03 04:58:02
int i = 27; int i(27); int i = { 27 }; int i { 27 }; ?
berndl 2017-03-03 04:58:17
Don't forget the auto versions.
mauke 2017-03-03 04:58:35
signed int i = 27; int signed i = 27; int (i) = 27; int ((i)) = 27;
nbro 2017-03-03 04:59:02
well, guys, I must say one thing
nbro 2017-03-03 05:00:16
C++ is complex mostly because it strives to be back-compatible with C and because of a bad type system
mauke 2017-03-03 05:00:41
C++ doesn't strive to be compatible with C
nbro 2017-03-03 05:00:56
mauke: it was originally designed to be
mauke 2017-03-03 05:00:59
no
nbro 2017-03-03 05:01:11
mauke: yes
mauke 2017-03-03 05:01:23
it stopped when it added the 'class' keyword
brynser_ 2017-03-03 05:01:40
"C with Classes"
nbro 2017-03-03 05:02:25
mauke: backward compatible means that any (or almost any) C program can be compiled by a C++ compiler
mauke 2017-03-03 05:02:33
not "almost"
mauke 2017-03-03 05:03:13
C++ made 'class' a keyword, which broke all C programs that did 'int class;' or similar
nbro 2017-03-03 05:03:26
mauke: you're saying different things
nitrix 2017-03-03 05:03:32
The OOP mania doesn't help.
nbro 2017-03-03 05:03:37
C is not C++, of course!
mauke 2017-03-03 05:03:39
this wouldn't be such a big deal, but C++ also redefined 'struct' to create classes
berndl 2017-03-03 05:03:46
C++ is complex because it inherited most of the stuff from C and added even more stuff on top.
nbro 2017-03-03 05:03:52
but C++ is (almost always) C
mauke 2017-03-03 05:03:53
so 'class' is actually 100% redundant
c_wraith 2017-03-03 05:03:53
that was an early goal of C++, but it was abandoned long ago. even without that keyword collision, some C constructs have different semantics in C++ now
mauke 2017-03-03 05:04:14
nbro: nonsense
nbro 2017-03-03 05:04:22
mauke: class and struct are different in C++
nbro 2017-03-03 05:04:37
struct makes fields public by default, class makes them private
mauke 2017-03-03 05:04:39
nbro: yes, one defaults to public, the other to private
mauke 2017-03-03 05:04:41
big deal
mauke 2017-03-03 05:05:03
you could still use 'struct Foo { private: ...}' everywhere and never need 'class'
nbro 2017-03-03 05:06:00
look, I'm not saying C++ is the most elegant language in terms of design, but it beats almost all the others almost in all context in terms of performance, so it's useful as a language
Sornaensis 2017-03-03 05:06:15
C++ is going to be entirely replaced by rust in a few years
bollu 2017-03-03 05:06:20
is there a way to simplify this? I have two (Data.Map x y), call them "m1" and "m2". I want to extract the key out of m1. if it does not exist, I want to take it out of m2. Best I could come up with way m1 ^. key <|> m2 ^. key
mauke 2017-03-03 05:06:21
performance is not a language property
karroffel 2017-03-03 05:06:42
Sornaensis: yeah, just like IPv6 replaced IPv4 5 years ago
Sornaensis 2017-03-03 05:06:47
bollu: is there a reason that's not simple enough for you?
karroffel 2017-03-03 05:06:48
I love Rust
karroffel 2017-03-03 05:06:51
don't get me wrong
nbro 2017-03-03 05:06:51
mauke: yes, I said it in that way to simplify things
Sornaensis 2017-03-03 05:06:53
karroffel: C++ is not as entrenched as C
bollu 2017-03-03 05:06:54
Sornaensis: curiosity, mostly
bollu 2017-03-03 05:07:01
Sornaensis: I want to see how much I can push lens
karroffel 2017-03-03 05:07:54
I see rust as a really really really capable competitor to C++, but I don't think C++ is going anywhere the next 10 years unfortunately
nbro 2017-03-03 05:08:03
Sornaensis: I'm also curious about rust, zero-cost abstractions, no gc, it really seems the most promosing language to replace C++ step by step
bollu 2017-03-03 05:08:05
karroffel: hm, why?
karroffel 2017-03-03 05:08:28
bollu: because the industry is slow when it comes to adapting new stuff
glguy 2017-03-03 05:08:42
the comparison of rust and c++ is off topic in #haskell
karroffel 2017-03-03 05:08:46
AAA games will still count on C++ as Rust is a bit too pure
karroffel 2017-03-03 05:09:00
Yeah true, sorry glguy :/
Sornaensis 2017-03-03 05:09:03
rust is heavily influenced by haskell tho
bollu 2017-03-03 05:11:13
Sornaensis: more ML
shapr 2017-03-03 05:11:38
Has anyone use HaNS for packet manipulation instead of purely as a TCP/IP stack?
fendor 2017-03-03 05:12:09
Short question, how can i get the binary representation of a number?
glguy 2017-03-03 05:13:36
> showIntAtBase 2 intToDigit 42 ""
lambdabot 2017-03-03 05:13:39
"101010"
fendor 2017-03-03 05:13:51
thanks a lot
nbro 2017-03-03 05:14:16
I really like Haskell, but there also a few minor things that I've already perceived in the language that could have been designed better, for example the fact that you need to wrap negative numbers with parenthesis when passing them to a function, that's kind of unnecessary tedios for such a minor thing
coltfred 2017-03-03 05:15:03
I agree that's a little annoying.
shapr 2017-03-03 05:15:05
nbro: what about keeping a list of the things that bug you, and then when you've learned Haskell, come back and fix them?
shapr 2017-03-03 05:15:21
or at least share the list after a month or two?
shapr 2017-03-03 05:15:37
nbro: Mind you, I'd want to see the other list as well, things that thrill you :-)
fendor 2017-03-03 05:16:05
the thing that thrills me most is when c++ programmers come at me and act like haskell is not a real language
nbro 2017-03-03 05:16:14
shapr: eheh
fendor 2017-03-03 05:16:25
that thrills me in haskell develeopment :D
shapr 2017-03-03 05:16:31
fendor: That's an odd way to start a discussion
fendor 2017-03-03 05:16:43
shapr, that was just a joke
shapr 2017-03-03 05:16:44
I like to show people useful everyday code I've written in Haskell.
shapr 2017-03-03 05:16:45
ha
nbro 2017-03-03 05:16:55
shapr: definitely not many things, I predict, compared to other lists ;)
fendor 2017-03-03 05:17:07
shapr, was not meant to be taken seriously, sorry
shapr 2017-03-03 05:17:12
nbro: well, keep track of the lists, I'm interested
glguy 2017-03-03 05:17:19
There's already an extension you can turn on to support negative literals
shapr 2017-03-03 05:17:22
nbro: Want to see some cool code I wrote as a weekend hack?
blackdog 2017-03-03 05:17:35
nbro: problem is that you'd have to make that a special case and make it more complicated to understand how operators work in general.
nbro 2017-03-03 05:17:37
shapr: yeah, why not?
shapr 2017-03-03 05:18:20
nbro: This displays info in my status bar from the JSON API of Atlanta's subway trains so I can get to work and other places on time: https://github.com/shapr/tmuxmarta/blob/master/src/Lib.hs
shapr 2017-03-03 05:19:44
nbro: I use byobu, and I put the resulting binary into ~/.byobu/bin/ as 60_marta so byobu will refresh the info every sixty seconds.
shapr 2017-03-03 05:20:54
output (at this instant) looks like: ["M:10","N:Arriving"] meaning a train going south from North Avenue is arriving, and a train going north from Midtown is ten minutes away.
shapr 2017-03-03 05:22:10
nbro: are you familiar with list comprehensions in Python?
nbro 2017-03-03 05:24:33
shapr: yes, I'm familiar with them
shapr 2017-03-03 05:25:47
nbro: Python's list comps were borrowed from Haskell, and TransformListComp gives even MOAR super list comp powers!
nbro 2017-03-03 05:26:10
shapr: yes, I noticed ;)
shapr 2017-03-03 05:26:27
nbro: Have you used LINQ in C#? The TransformListComp extensions remind me of LINQ: https://www.schoolofhaskell.com/school/to-infinity-and-beyond/pick-of-the-week/guide-to-ghc-extensions/list-and-comprehension-extensions
nbro 2017-03-03 05:27:54
shapr: I've used C# 2-3 years ago and I don't think I've ever used LINQ…
shapr 2017-03-03 05:28:24
oh, I really enjoyed writing LINQ, you can make some amazingly powerful pipelines that mix sql results, anonymous objects, and everything else.
shapr 2017-03-03 05:28:58
nbro: What got you interested in Haskell?
nbro 2017-03-03 05:29:57
I would like to have the opportunity to go back to C#, but I've not programmed on Windows for a while, even though now it can also be used as a cross-platform language because of mono
nbro 2017-03-03 05:30:41
shapr: I got interested in Haskell already a few months ago, but I only started learning it like not even a week ago
nbro 2017-03-03 05:31:00
oh
nbro 2017-03-03 05:31:05
sorry, you asked "what"
shapr 2017-03-03 05:31:10
sure, that's fine too
nbro 2017-03-03 05:31:54
first because it's a pure functional language
nbro 2017-03-03 05:32:21
it's also probably the most used one
shapr 2017-03-03 05:32:47
Yeah, lots of commercial use of Haskell
maerwald 2017-03-03 05:33:40
lots?
shapr 2017-03-03 05:33:44
Here at work Haskell is mostly used for pandoc, xmonad, and shellcheck.
shapr 2017-03-03 05:34:01
Though we almost chose PFQ instead of DPDK, oh well
maerwald 2017-03-03 05:34:20
last I checked even Prolog was ahead on the Tiobe index. Then there was a survey about used programming languages where haskell scored as a "weekend language"
shapr 2017-03-03 05:34:28
maerwald: yeah, I think lots, have you seen the CUFP talks?
shapr 2017-03-03 05:35:49
nbro: Do you have a project you want to implement in Haskell?
maerwald 2017-03-03 05:35:57
do they provide numbers or talk about surveys in industry?
nbro 2017-03-03 05:38:08
shapr: I would like to exploit Haskell where, let's say, it excels, for example in a multi-threading environment, but first I need to learn the language very well
nbro 2017-03-03 05:39:10
it excels in the sense that by default we do not have mutable things
nbro 2017-03-03 05:39:45
now I'm still not familiar with libraries and the actual support for multi-threading
shapr 2017-03-03 05:39:59
Yeah, the multicore support is especially nifty
Sornaensis 2017-03-03 05:40:37
haskell has the finest implementation of software transactional memory afaik
Sornaensis 2017-03-03 05:40:42
well, ghc
maerwald 2017-03-03 05:41:08
and ghc breaks errno thread safety :P
ongy 2017-03-03 05:43:23
I thought ghc saves errno into the haskell threads for that reason?
meijiJAPAN 2017-03-03 05:43:56
Is it possible to do web development with Haskell
meijiJAPAN 2017-03-03 05:44:21
And if so, how it is different compared to Scala
liste 2017-03-03 05:44:42
karroffel: yes, it's possible.
liste 2017-03-03 05:44:51
meijiJAPAN: ^
liste 2017-03-03 05:44:54
not karroffel, sorry
maerwald 2017-03-03 05:44:55
ongy: I don't know, that's what I got from discussions with more knowledable people here, I asked about it