Search Haskell Channel Logs

Sunday, January 29, 2017

#haskell channel featuring chattered, hpc, srhb, Malleus, ph88, megaTherion, and 6 others.

cocreature 2017-01-29 01:45:41
systadmin: the problem is trying to translate individual expressions/statements. it's better to find a problem, solve it in python and then find a solution in haskell and compare these two
cocreature 2017-01-29 01:46:04
the syntax & semantics of python & haskell are two different for translations based on individual statements
systadmin 2017-01-29 01:46:39
Okay, just one more Python to Haskell translation (I couldn't help it.). What does Haskell have in place of Python's input()?
srhb 2017-01-29 01:47:03
systadmin: It doesn't.
systadmin 2017-01-29 01:47:12
oh way
srhb 2017-01-29 01:47:22
There are various plugins approaches, but they're extremely dissimilar.
srhb 2017-01-29 01:47:34
(lambdabot uses hint, which is one of them, iirc)
cocreature 2017-01-29 01:47:54
srhb: input() is not eval(), right?
srhb 2017-01-29 01:48:07
cocreature: It's getLine >>= execute, iirc
srhb 2017-01-29 01:48:13
Or something like that :-P
cocreature 2017-01-29 01:48:23
srhb: I think it's just getLine
cocreature 2017-01-29 01:48:26
without the execute part
srhb 2017-01-29 01:48:27
Oh, is it.
cocreature 2017-01-29 01:48:43
systadmin: so the answer is "getLine"
systadmin 2017-01-29 01:49:11
:t getLine
lambdabot 2017-01-29 01:49:13
IO String
srhb 2017-01-29 01:49:24
cocreature: >>> input(); 1+1; 2
ahihi 2017-01-29 01:49:31
python 3 input() scrapped the evaluation part
srhb 2017-01-29 01:49:38
Aha, hence the confusion.
cocreature 2017-01-29 01:50:05
sure just change the semantics of a function completely but keep the name …
srhb 2017-01-29 01:50:09
:-)
srhb 2017-01-29 01:50:15
It's backwards compatible!
cocreature 2017-01-29 01:51:40
systadmin: so "getLine" is python 3's input(), emulating python 2's input() is more complex
systadmin 2017-01-29 01:52:01
In Python2 it's raw_input()
chattered 2017-01-29 01:53:09
There's an idiom in SML where, as you map over a data-structure, you check at each level whether what you got back is pointer identical to what you started with, and if so, you just return the original. In this way, map id doesn't have to do any allocation. Does Haskell have any story on this?
systadmin 2017-01-29 01:57:51
I need to add `do` to my getLine function?
srhb 2017-01-29 02:00:59
systadmin: That's not how `do` works.
systadmin 2017-01-29 02:01:31
?
srhb 2017-01-29 02:01:37
`do foo` is equivalent to `foo`. always.
srhb 2017-01-29 02:07:39
systadmin: Perhaps if you rephrase the question in a more general manner: What are you trying to achieve?
Malleus 2017-01-29 02:15:56
I'm a C# dev looking into functional programming. Can i build Websites using Haskell as well as Text based games such as MUDs? What I'm really asking is what is it good for
megaTherion 2017-01-29 02:20:44
Malleus: you know LINQ?
malleus99 2017-01-29 02:22:26
yeah linq is awesome
megaTherion 2017-01-29 02:22:39
then this is basically functional programming
megaTherion 2017-01-29 02:23:02
however since you're a C# dev already, I might suggest looking into F# first - because then you'll work with an familiar eco system at hand
malleus99 2017-01-29 02:24:51
ah yeah i forgot about F# sharp. I'll have a look at that too
epta 2017-01-29 02:25:02
megaTherion: how come that LINQ is a functional programming?
epta 2017-01-29 02:25:29
isn't it just a bunch of Data.List routines over lazy lists?
hpc 2017-01-29 02:26:25
higher-order functions over lazy lists, is how i would put it
hpc 2017-01-29 02:26:48
or some other type of stream, like an sql query (where stepping through the result set is an IO effect)
megaTherion 2017-01-29 02:26:55
epta: ok one part of it ^^
hpc 2017-01-29 02:27:13
it's a bit like a special form of do-notation
hpc 2017-01-29 02:28:47
malleus99: the way i would break it down is learn F# if you want to carry over as much of your existing knowledge as possible, learn haskell if you want to literally never stop learning new things :D
epta 2017-01-29 02:30:20
LINQ example is horrible because of it's implementation. They did a separate instance of IEnumerable/IEnumerator for each and every function. It doesn't have anything in common with abstract implementation of correspondent methods in Data.List
epta 2017-01-29 02:30:33
So it's not really high order as you said
malleus99 2017-01-29 02:31:30
I love learning new things and the different syntax and the complexity at 1st sight is drawing me to it. just wondering what i can do it with that might benefit me career wise. I guess could be a fun hobby language maybe
epta 2017-01-29 02:31:56
> Can i build Websites using Haskell as well as Text based games such as MUDs < yes, but it will take 10x more time because of a different paradigm
lambdabot 2017-01-29 02:31:58
:1:82: error: parse error on input ','
epta 2017-01-29 02:32:53
malleus99: perfect choise as a hobby language indeed
malleus99 2017-01-29 02:34:24
some of the jobs pay well too but seem quite scientific or involve a lot of math knowledge from what I've seen
hpc 2017-01-29 02:35:24
the way i would put it is you will learn about new concepts well before they become mainstream (which most of them inevitably do)
hpc 2017-01-29 02:35:54
a couple of weeks ago i had that with parser combinators
hpc 2017-01-29 02:36:59
at work i found a domain-specific library that we could use for some specific stuff, and it happened to expose an API that worked a lot like trifecta
hpc 2017-01-29 02:37:16
it's pretty flawed in a lot of ways, but it uses the same parser for parsing and pretty-printing
hpc 2017-01-29 02:39:49
(or you learn them more generally, like transactions via STM)
ph88 2017-01-29 02:44:52
hhmm 4K loc causing some serious compilation times :P