c_wraith 2017-03-02 11:45:30
nbro, the thing about Haskell is that Nothing isn't a special value and Maybe isn't a special type. they're completely normal things defined in pure haskell in the standard library.
monochrom 2017-03-02 11:45:52
To sum up, Python goes subtype polymorphism, Haskell goes parametric polymorphism. And there is a sense in which they are opposites.
nbro 2017-03-02 11:46:06
monochrom: if this Maybe a wouldn't have been invited, how could you represent the absence of something in Haskell?
ski 2017-03-02 11:46:13
nbro : conceptually, `Maybe T' "adds a new value to `T'". this means that `Maybe (Maybe T)' will now how two values in addition to the ones of form `Just (Just x)', with `x' of type `T'. this is unlike the story with nulls
nbro 2017-03-02 11:46:13
*invented
mniip 2017-03-02 11:46:22
nbro, invent your own?
monochrom 2017-03-02 11:46:28
It can always be invented and reinvented.
c_wraith 2017-03-02 11:46:37
nbro, you'd create a type just like it. there's nothing special about it. no magic.
monochrom 2017-03-02 11:46:38
In fact I know that the GHC API reinvented it once.
nbro 2017-03-02 11:46:40
@monochrom I mean, the concept
lambdabot 2017-03-02 11:46:41
Unknown command, try @list
mniip 2017-03-02 11:46:46
@let data Maybe' a = Nothing' | Just' a
lambdabot 2017-03-02 11:46:49
Defined.
monochrom 2017-03-02 11:46:58
And some http library revinvented it too.
nbro 2017-03-02 11:47:03
suppose for a moment that nobody managed to invent such a thing
monochrom 2017-03-02 11:47:11
Yes, the concept. It can always be reinvented.
mniip 2017-03-02 11:47:24
> Just' 3
c_wraith 2017-03-02 11:47:25
nbro, it's basically impossible to not invent when you have algebraic data types.
lambdabot 2017-03-02 11:47:28
Just' 3
mniip 2017-03-02 11:47:30
> Nothing'
lambdabot 2017-03-02 11:47:34
Nothing'
monochrom 2017-03-02 11:47:38
OK, suppose that. Then we can prove true = false too. Yes, it's a vacuous premise.
monochrom 2017-03-02 11:48:14
Alternatively, why don't you suppose python did not have class and/or objects?
mniip 2017-03-02 11:48:48
nbro, well, suppose we want to represent absence of something in haskell
mniip 2017-03-02 11:49:08
e.g we want a type that is either an int or nothing
mniip 2017-03-02 11:49:17
data FancyInt = AnInt Int | NoInt
mniip 2017-03-02 11:49:30
but wait we want it for more types than just Int
mniip 2017-03-02 11:49:36
why not make it parametric
mniip 2017-03-02 11:49:43
data FancyThing a = AThing a | NoThing
mniip 2017-03-02 11:49:53
oops invented maybe
monochrom 2017-03-02 11:50:30
In Python you can use "none" wherever a list is expected, or a set is expected, or a date is expected, etc etc. This is why I mentioned subtyping. "none" is of NoneType but the thing is NoneType is a subtype of essentially all other types.
monochrom 2017-03-02 11:50:44
But Haskell doesn't do that. Haskell does the opposite.
mniip 2017-03-02 11:51:04
monochrom, huh?
monochrom 2017-03-02 11:51:17
In Haskell you can't use "Nothing" wherever a list is expected, or a set is expected, or a date expected. You can only use it where a "Maybe XXX" is expected.
nbro 2017-03-02 11:51:35
@mniip maybe I shouldn't have said "not to break the type system", which seems like one's blaspheming for a religious person
lambdabot 2017-03-02 11:51:35
Unknown command, try @list
mniip 2017-03-02 11:51:45
monochrom, fairly sure you can't use None everywhere in python
mniip 2017-03-02 11:52:03
however you might have a different idea of what 'types' really mean in python
mniip 2017-03-02 11:52:13
def foo(x): return x[1]
mniip 2017-03-02 11:52:21
does that function take None? I don't think so
mbw 2017-03-02 11:52:33
What are the modules Data.Array.IO.Safe and the other "Safe" ones for? I can't see any differences...
mbw 2017-03-02 11:52:51
Between those and the parent modules, that is
monochrom 2017-03-02 11:52:57
OK, I was wrong, but I think it can be saved. Can that function return None?
mniip 2017-03-02 11:53:39
sure
mniip 2017-03-02 11:53:41
it returns exists a. a
monochrom 2017-03-02 11:53:41
OK, so s/use/return/ and I think I'm good.
Tuplanolla 2017-03-02 11:53:41
It seems to have no problems taking `None` for me, mniip.
mniip 2017-03-02 11:54:11
but NoneType has no __getitem__
Tuplanolla 2017-03-02 11:54:52
For sure, but that happens after you have given the procedure your `None`.
Ch3ck 2017-03-02 11:55:25
What is a blackhole, as it relates to haskell or programming?
mniip 2017-03-02 11:55:25
nbro, not really, we are not closed-minded, it's just that your proposition is actually of little logical sense
Tuplanolla 2017-03-02 11:55:25
Perhaps I don't know what to expect here.
nbro 2017-03-02 11:55:25
and maybe Python wasn't the best example to compare things with Haskell, lol
mniip 2017-03-02 11:55:33
Tuplanolla, then all functions are universal in python
mniip 2017-03-02 11:55:35
just some are partial
Tuplanolla 2017-03-02 11:55:41
...yes?
mniip 2017-03-02 11:55:43
that's a useless representation
mniip 2017-03-02 11:56:00
monochrom hinted at subtyping as a useful representation of typing rules in python
nbro 2017-03-02 11:56:19
@mniip ok, no problem, give me one month and you will see another master in haskell :D lol
lambdabot 2017-03-02 11:56:20
Unknown command, try @list
mniip 2017-03-02 11:56:32
month huh
mbw 2017-03-02 11:56:39
Does anybody know what the "Safe" variants of the Data.Array headers are for? Does it have to do with safe haskell?
lyxia 2017-03-02 11:56:41
mbw: note the Safe Haskell field in the header.
monochrom 2017-03-02 11:56:51
I am not religious. This is why I questioned "what is there to break?"
mniip 2017-03-02 11:56:52
I've been here for 3 years and I wouldn't call myself "master" by any chance
mbw 2017-03-02 11:57:31
lyxia: Ok, that confirms my suspicion. But in what way do these modules differ? Is the API more stable?
geppettodivacin 2017-03-02 11:57:50
Ch3ck: Pretty sure that it usually refers to a function that can never return, but isn't detectable as a loop.
mniip 2017-03-02 11:58:26
no
monochrom 2017-03-02 11:58:29
isn't? is?
mniip 2017-03-02 11:58:50
Ch3ck, a blackhole is a thunk that is currently being evaluated by ghc
mniip 2017-03-02 11:59:04
it is distinctly highlighted for a number of reasons
monochrom 2017-03-02 11:59:13
Because if the computer bothers to print a "black hole" message, certainly something has been detected.
mniip 2017-03-02 12:00:12
if one thread wants to evaluate a thunk and it's a blackhole, it knows another thread is evaluating it, and it can subscribe to the blackhole to let the evaluating thread wake it up once the computation is done
lyxia 2017-03-02 12:00:21
mbw: I don't know, sorry.
mniip 2017-03-02 12:00:28
and if a thread evaluates a blackhole that it is itself evaluating, it'll know that it's stuck in a loop
mniip 2017-03-02 12:00:39
or something like that
nbro 2017-03-02 12:01:00
@mniip by master I mean to master the concepts behind the programming language, not all features or libraries, etc ;)
lambdabot 2017-03-02 12:01:00
Unknown command, try @list
mniip 2017-03-02 12:01:01
would you like to know more? read the ghc commentary and/or the stg paper
mniip 2017-03-02 12:01:13
nbro, you underestimate its power
nbro 2017-03-02 12:01:58
@mniip maybe yes :D
lambdabot 2017-03-02 12:01:58
Unknown command, try @list
geppettodivacin 2017-03-02 12:02:06
Ah, I too have learned something. Neat.
mbw 2017-03-02 12:03:23
lyxia: No sweat. At least I know what to look up next. I have time...
ertes 2017-03-02 12:04:13
nbro: don't think of Maybe or Nothing as something special
ertes 2017-03-02 12:04:28
Maybe does not have any special status… in fact it's defined in a library
ertes 2017-03-02 12:04:47
however, haskell itself is special to a certain degree in that it does not have an observable "null"
mniip 2017-03-02 12:05:20
base is a special enough library so that's a poor argument :p
ertes 2017-03-02 12:05:32
base certainly is, but Maybe isn't =)
Koterpillar 2017-03-02 12:05:33
ertes: that is not special; null is special
ertes 2017-03-02 12:06:10
Koterpillar: in the sense that a lot of languages have that special value… haskell is more natural, yes, but it's certainly the special one among most other languages
ertes 2017-03-02 12:06:15
in that those other languages are unnatural
monochrom 2017-03-02 12:06:19
"special relativity"
nbro 2017-03-02 12:06:49
ahah
nbro 2017-03-02 12:07:03
nice conversations here
mniip 2017-03-02 12:07:08
terminologicaly SR is a special case of GR so all is well
monochrom 2017-03-02 12:07:25
yeah just punning
mbw 2017-03-02 12:09:18
Ok, I just read about safe haskell: https://wiki.haskell.org/Safe_Haskell. Quote: "For typical Haskell programmers, using {-# LANGUAGE Safe #-} will be like -Wall: something that is considered good practice from a hygiene point of view." Is there general consensus on this, or is it not widely used after all?
mbw 2017-03-02 12:10:45
Btw the billion dollar mistake was not a null pointer dereference, but something like a comma instead of a colon in a FORTRAN format string, if I remember correctly.
ertes 2017-03-02 12:11:35
in that sense the billion dollar mistake was FORTRAN
mbw 2017-03-02 12:12:15
That's probably the gist of Backus' Turing award speech :)
ertes 2017-03-02 12:13:09
i also liked peter sewell's examination: https://media.ccc.de/v/31c3_-_6574_-_en_-_saal_1_-_201412301245_-_why_are_computers_so_and_what_can_we_do_about_it_-_peter_sewell
monochrom 2017-03-02 12:15:04
Wait, so Backus invented functional programming for avoiding comma and colon typos?!
mbw 2017-03-02 12:16:06
Even if so, he didn't succeed. Fortran is still around.
Nolrai 2017-03-02 12:16:28
Ch3ck : It's a way for the compiler to catch some infinite loops, basically.
geekosaur 2017-03-02 12:17:08
comma instead of period is actually an urban legend, iirc. but mostly that one is just lexing; pre-fortran90 considered DO 10 I = 1. 10 (typo period for comma in a loop starter) and DO10I = 1.10 (assignment) the same...
Ch3ck 2017-03-02 12:18:16
Nolrai, this is the first time I'm hearing of the concept. It is unique to haskell?
mbw 2017-03-02 12:18:29
Good old "IMPLICIT DOUBLE PRECISION (A-H,O-Z)"
nbro 2017-03-02 12:18:50
thanks for your help! I will probably come back ;)
mbw 2017-03-02 12:20:08
If you think about it, python has this...
mniip 2017-03-02 12:21:45
Nolrai, uhh
mniip 2017-03-02 12:21:49
that's somewhat misleading too
mniip 2017-03-02 12:22:04
its primary purpose is multithreading
monochrom 2017-03-02 12:22:24
detecting a special kind of nontermination is a side effect
Nolrai 2017-03-02 12:23:35
Nolrai 2017-03-02 12:23:53
Hmm. I wonder what I read that led me astray.
monochrom 2017-03-02 12:26:01
It doesn't take a lot of reading. It is an easy guess from personal experience. The thing is that it is non-obvious why the runtime system even bothers.
Ch3ck 2017-03-02 12:33:07
So is it unique to haskell?
Ch3ck 2017-03-02 12:33:14
I'm a FP and Haskell newbie :-)
monochrom 2017-03-02 12:34:57
Oh yikes haha "The obsolete language options -XPolymorphicComponents and -XRank2Types are synonyms for -XRankNTypes" (GHC 8.0.2 or maybe earlier)
glguy 2017-03-02 12:35:35
That happened before GHC 8, I don't remember when in the 7 series it was, though
ertes 2017-03-02 12:37:54
yeah, Rank2Types was obsoleted a long time ago
monochrom 2017-03-02 12:38:13
Ah OK.
monochrom 2017-03-02 12:38:40
I agree that if you use PolymorphicComponents then you're very likely to also use RankNTypes.
ertes 2017-03-02 12:38:46
IMO it was a pointless extension anyway, because you could always just use a rank-2 subset of RankNTypes
monochrom 2017-03-02 12:40:05
The lack of a significant second compiler that makes a difference.
mniip 2017-03-02 12:40:14
Ch3ck, it's unique to STG
mniip 2017-03-02 12:40:31
the graph reduction machine implementation as it appears in GHC
mniip 2017-03-02 12:40:52
once again, read up on ghc commentary and/or the stg paper
Ch3ck 2017-03-02 12:40:53
mniip, what's STG?
Ch3ck 2017-03-02 12:41:01
Ahh I see
monochrom 2017-03-02 12:41:04
Because IIRC there is still a theoretical difference between rank-2 and rank-all-in, and it could cause a difference in how-hard-to-implement too.
geppettodivacin 2017-03-02 12:41:12
So not only Haskell specific, but GHC specific.
mniip 2017-03-02 12:41:42
monochrom, there's a terminating rank2 checker
vtomole 2017-03-02 12:41:47
Any other "fleshed out" haskell implementations other than ghc?
mniip 2017-03-02 12:41:50
not a rank3 however
ertes 2017-03-02 12:42:52
Ch3ck: in fact it's specific to the GHC *compiler*
ertes 2017-03-02 12:43:03
> let x = x in x
lambdabot 2017-03-02 12:43:03
mueval-core: Time limit exceeded
ertes 2017-03-02 12:43:18
a compiled program would have thrown an exception your way
Ptival 2017-03-02 12:43:37
is there a good reason why Tasty Assertions can't be written agnostically w.r.t. what type of check is to be performed?
davean 2017-03-02 12:43:40
vtomole: there have been a few
kuribas 2017-03-02 12:43:55
If I force an expression in the ghci debugger, then after :step, it's again unevaluated, it's a bug right?
davean 2017-03-02 12:44:01
vtomole: GHC is the one that has the energy to be regularly maintained though, the others end up tending to be rather nitch in practice
mniip 2017-03-02 12:44:07
kuribas, it could be polymorphic
glguy 2017-03-02 12:44:07
kuribas: or it has a polymorphic type
kuribas 2017-03-02 12:44:25
not polymorphic...
mniip 2017-03-02 12:44:27
however RTTI is complicated enough that it's not out of consideration
ertes 2017-03-02 12:44:28
vtomole: haste is a non-GHC haskell compiler that targets JS
ertes 2017-03-02 12:44:31
it still works
kuribas 2017-03-02 12:44:44
mniip: glguy, a Double
mniip 2017-03-02 12:44:56
are you sure it's the same expression