monochrom 2017-03-02 10:45:44
OK, we don't usually include non-termination and similarly uncomputable conditions as exceptions. OK, let's just say I don't.
davean 2017-03-02 10:46:22
monochrom: it throws a Haskell exception in many cases
Tuplanolla 2017-03-02 10:46:42
@hoogle NonTermination
monochrom 2017-03-02 10:46:42
When I hear "exception" I only think of head [] and division by zero and a few more similar things, things that are finite-running-time detectable at the very least.
lambdabot 2017-03-02 10:46:45
Control.Exception data NonTermination
lambdabot 2017-03-02 10:46:45
Control.Exception NonTermination :: NonTermination
lambdabot 2017-03-02 10:46:45
Control.Exception.Base data NonTermination
davean 2017-03-02 10:47:19
monochrom: and yet, thats not Haskell's explicite notion of exception at all
davean 2017-03-02 10:47:52
monochrom: So, all I can say is your definition seems entirely irrelivent in a discussion about Haskell?
davean 2017-03-02 10:48:21
I mean we could have other definitions
monochrom 2017-03-02 10:53:18
OK. Haskell. Computability you said?
monochrom 2017-03-02 10:53:57
Does the so-called "NonTermination" exception, and blackholing and whiteholing and whatnot, fall under computability issue?
davean 2017-03-02 10:54:20
monochrom: in some cases
davean 2017-03-02 10:54:31
They can be generated by obvious means also
davean 2017-03-02 10:55:02
But the limit of when they can be thrown is too unconstrained by Haskell's type system to be generally determinable
monochrom 2017-03-02 10:55:18
Because of the "meaningful" name "NonTermination" which mislead you to think it is really about non-termination?
davean 2017-03-02 10:55:41
monochrom: What do you think I mena by computability?
davean 2017-03-02 10:55:48
monochrom: I specificly meant the halting problem
davean 2017-03-02 10:56:07
Though we could start talking rice's I suppose
nbro 2017-03-02 11:21:18
Hi
ski 2017-03-02 11:21:44
Lo
nbro 2017-03-02 11:22:22
I'm quite new to Haskell, but let me tell you it seems already a very nice language
nbro 2017-03-02 11:22:37
anyway, I've a problem
benzrf 2017-03-02 11:22:38
nbro: :)
nbro 2017-03-02 11:23:11
I think I understood the idea behind the Maybe a type
nbro 2017-03-02 11:23:11
but maybe not enough
nbro 2017-03-02 11:23:39
because I'm asked to write an expression of type Maybe Bool…
nbro 2017-03-02 11:24:16
but I'm not really sure what would that mean, so I think I didn't understand what Maybe a…
nbro 2017-03-02 11:24:28
is
benzrf 2017-03-02 11:24:31
what resource are u using?
nbro 2017-03-02 11:25:07
I'm using different ones, including hoogle to search for the documentation (maybe I'm just tired)
nbro 2017-03-02 11:25:10
:D
ski 2017-03-02 11:25:10
for every type `a' (e.g. `Bool'), `Maybe a' is a type (`Maybe Bool' in that example)
ski 2017-03-02 11:25:33
for any type `a', `Nothing' has type `Maybe a'
ski 2017-03-02 11:25:44
for any type `a', if `x' has type `a', then `Just x' has type `Maybe a'
ski 2017-03-02 11:26:05
this is what
ski 2017-03-02 11:26:07
@src Maybe
lambdabot 2017-03-02 11:26:08
data Maybe a = Nothing | Just a
ski 2017-03-02 11:26:09
means
ski 2017-03-02 11:26:34
(which is what the definition of `Maybe' looks like)
nbro 2017-03-02 11:28:02
well, from what I understood Nothing and Just a are data constructors, right?
ski 2017-03-02 11:28:40
`Nothing' and `Just' are data constructors, yes
nbro 2017-03-02 11:30:02
so
nbro 2017-03-02 11:30:15
Just True would be of type Maybe Bool..
Nolrai 2017-03-02 11:30:31
Yes.
ski 2017-03-02 11:31:09
also `Just (not True)'
ertes 2017-03-02 11:33:36
nbro: data Maybe a = Nothing | Just a -- alternatively you can say that every value of type (Maybe a) is either of the shape Nothing or of the shape (Just x), where 'x' is of type 'a'
ertes 2017-03-02 11:34:37
data Bool = False | True -- just like every value of type Bool is either of the shape False or of the shape True
nbro 2017-03-02 11:38:26
but Nothing has type Maybe a only not to break the type system, let's say, right?
ertes 2017-03-02 11:39:27
nbro: what do you mean?
ertes 2017-03-02 11:40:10
Nothing is a legal value of type (Maybe a) for any 'a'
monochrom 2017-03-02 11:41:32
(What is there to break?)
mniip 2017-03-02 11:41:33
you're saying "only not to break the type system" as if it were some kind of workaround
mniip 2017-03-02 11:41:42
however that's just how ADTs work
nbro 2017-03-02 11:41:48
well, this nothing can somehow be compared with the nils, nones, and nulls of other programming languages, but in those programming languages, for example in Python, None is of type NoneType, but in Haskell the trick to indicate that something could be or contain indeed nothing is by "wrapping" our types in this Maybe a
mniip 2017-03-02 11:41:51
it's a feature and whatnot
mniip 2017-03-02 11:42:27
nbro, python is irrelevant because types are properties of values there
mniip 2017-03-02 11:43:01
(like basically any other dynamically typed langauge)
monochrom 2017-03-02 11:43:03
I don't really understand that sentence. But Python has subtyping and Haskell doesn't. Therefore Python's none story can be different from Haskell's Nothing story.
mniip 2017-03-02 11:43:51
hmm, subtyping, that's a nice way too look at it
monochrom 2017-03-02 11:43:51
And neither approach is to prevent "breaking", whatever that means.
nbro 2017-03-02 11:44:08
I'm just comparing the conceptual way of representing nothing in different languages…
mniip 2017-03-02 11:44:13
nbro, haskell, for example, has a truly empty type
mniip 2017-03-02 11:44:20
a type of which no value exists
nbro 2017-03-02 11:44:21
in order to understand better the one in Haskell
mniip 2017-03-02 11:44:32
any computation that has a result of that type must either error or not terminate
monochrom 2017-03-02 11:45:05
Or alternatively but equivalently, every language design is to prevent "breaking" something, so you could tautologically say that everything done in Haskell is to prevent breaking the Haskell way, everything done in Python is to prevent breaking the Python way, etc etc, which sounds really nice but is informationless.