Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-03-23 10:22:31 jacks2 joins (~bc8134e3@217.29.117.252)
2021-03-23 10:24:14 × PtxDK quits (~quassel@2a01:7c8:aac3:591:5054:ff:fe3d:cac6) (Quit: No Ping reply in 180 seconds.)
2021-03-23 10:24:39 Alleria joins (~textual@zrcout.mskcc.org)
2021-03-23 10:25:01 × pavonia quits (~user@unaffiliated/siracusa) (Quit: Bye!)
2021-03-23 10:25:02 Alleria is now known as Guest79447
2021-03-23 10:25:20 PtxDK joins (~quassel@2a01:7c8:aac3:591:5054:ff:fe3d:cac6)
2021-03-23 10:28:08 × aarvar quits (~foewfoiew@2601:602:a080:fa0:75fb:cea1:4d26:9157) (Ping timeout: 240 seconds)
2021-03-23 10:30:37 peanut_ joins (~peanut@2a02:8388:a101:2600:9f7e:958d:f1dd:b94a)
2021-03-23 10:32:26 frozenErebus joins (~frozenEre@94.128.81.87)
2021-03-23 10:34:42 Nahra joins (~Nahra@unaffiliated/nahra)
2021-03-23 10:35:06 rond_ joins (594021ff@89-64-33-255.dynamic.chello.pl)
2021-03-23 10:35:36 <rond_> Hi! What is a 'literal'? I've stumbled upon this term with no definition
2021-03-23 10:35:51 Benzi-Junior joins (~BenziJuni@dsl-149-67-143.hive.is)
2021-03-23 10:35:54 <shachaf> What's the context?
2021-03-23 10:36:17 <shachaf> It probably means somthing like a number or a string written out in source code (i.e. a literal value, rather than a variable referring to a value).
2021-03-23 10:36:31 <Uniaika> rond_: 1, or "string"
2021-03-23 10:36:37 <rond_> All literal constants are of primitive type.
2021-03-23 10:36:38 <rond_> Literals of algebraic type are expressed by giving an explicit application of a constructor.
2021-03-23 10:36:50 <rond_> Uniaika that's hardly a definition...
2021-03-23 10:36:59 <Uniaika> because I gave you an example ;)
2021-03-23 10:37:02 <rond_> what about [1,2,3] ?
2021-03-23 10:37:08 × stree quits (~stree@68.36.8.116) (Ping timeout: 245 seconds)
2021-03-23 10:37:12 × z0k quits (~user@115.186.169.1) (Ping timeout: 256 seconds)
2021-03-23 10:37:25 <Uniaika> yeah it's a list litteral
2021-03-23 10:37:34 <peanut_> https://hackage.haskell.org/package/ghc-8.10.2/docs/Literal.html
2021-03-23 10:37:59 <shachaf> What's the full context?
2021-03-23 10:38:02 <shachaf> Is this the STG paper?
2021-03-23 10:38:08 <rond_> yes
2021-03-23 10:38:22 <shachaf> It looks like page 20 says what literals are.
2021-03-23 10:38:24 <rond_> I didn't know that it would be known here :O
2021-03-23 10:38:58 <shachaf> Oh, no, I guess they use it in a more general way later on.
2021-03-23 10:39:00 PtxDK_ joins (~quassel@2a01:7c8:aac3:591:5054:ff:fe3d:cac6)
2021-03-23 10:39:02 <rond_> Exactly!
2021-03-23 10:39:03 × PtxDK quits (~quassel@2a01:7c8:aac3:591:5054:ff:fe3d:cac6) (Ping timeout: 272 seconds)
2021-03-23 10:39:04 × bitdex quits (~bitdex@gateway/tor-sasl/bitdex) (Remote host closed the connection)
2021-03-23 10:39:08 <rond_> without a definition...
2021-03-23 10:39:38 <rond_> literal == data value    - do you think it's justified?
2021-03-23 10:39:44 <rond_> Since everything is immutable... ?
2021-03-23 10:39:45 <peanut_> [1,2,3] is a list of integer literals, I don't think the list is a literal itself
2021-03-23 10:39:50 <shachaf> OK, my reading is, when they say "literal", they mean something of a primitive type, like integers.
2021-03-23 10:40:09 bitdex joins (~bitdex@gateway/tor-sasl/bitdex)
2021-03-23 10:40:14 <shachaf> And maybe other things if you add them to your language, but I don't think their simple language has that.
2021-03-23 10:40:29 <rond_> So "Literals of algebraic type are expressed by giving an explicit application of a constructor." basically refers to boxed IntegeR?
2021-03-23 10:40:41 <shachaf> That one sentence about literals of algebraic data types is saying that things like [1,2,3] -- or even "abc" -- don't count as literals.
2021-03-23 10:40:49 <shachaf> Or Integer, sure.
2021-03-23 10:41:19 <rond_> Why [1,2,3] doesn't fall into "expressed by giving an explicit application of a constructor." ?
2021-03-23 10:41:25 <shachaf> Because [1,2,3] is actually "Cons 1 (Cons 2 (Cons 3 Nil))", and only the values of primitive types are literals.
2021-03-23 10:41:29 × Kaiepi quits (~Kaiepi@47.54.252.148) (Remote host closed the connection)
2021-03-23 10:41:48 <shachaf> It does -- in context, that sentence is saying those things *don't* count as literals, I think.
2021-03-23 10:42:24 Neuromancer joins (~Neuromanc@unaffiliated/neuromancer)
2021-03-23 10:42:28 <rond_> My understanding is "Literals of algebraic type are" means that we have 2 distinguishable types of literals
2021-03-23 10:43:33 <shachaf> This is my reading: All literal constants are of primitive type; [what you might, in another context, call "]literals of algebraic type["] are expressed by giving an explicit application of a constructor.
2021-03-23 10:43:40 <rond_> All literal constants are of primitive type.
2021-03-23 10:43:40 <rond_> Literals of algebraic type are expressed by giving an explicit application of a constructor.
2021-03-23 10:43:41 <rond_> Don't you read it as
2021-03-23 10:43:41 <rond_> "1. Literal constants are:...
2021-03-23 10:43:42 <rond_> 2. Literals of algebraic type are..."
2021-03-23 10:43:42 <rond_> so two definitions for two distinguishable concepts?
2021-03-23 10:43:59 MilkywayPirate joins (~user@178.157.255.8)
2021-03-23 10:44:11 <shachaf> My guess is that this doesn't matter too much for understanding the paper, anyway.
2021-03-23 10:44:38 kam1 joins (~kam1@37.129.96.190)
2021-03-23 10:45:02 heatsink joins (~heatsink@2600:1700:bef1:5e10:b09b:3609:dd4b:42c9)
2021-03-23 10:45:02 × kam1 quits (~kam1@37.129.96.190) (Read error: Connection reset by peer)
2021-03-23 10:45:43 <rond_> Data types are divided into:
2021-03-23 10:45:44 <rond_> I algebraic data types: introduced explicitly by data declarations.
2021-03-23 10:45:44 <rond_> I primitive data types: built into the system.
2021-03-23 10:45:45 <rond_> For the purpose of this paper:
2021-03-23 10:45:45 <rond_> primitive types == unboxed types
2021-03-23 10:45:46 <rond_> All literal constants are of primitive type.
2021-03-23 10:45:46 <rond_> Literals of algebraic type are expressed by giving an explicit application of a constructor.
2021-03-23 10:45:47 <rond_> All arithmetic built-in operations operate over primitive values (for example +#).
2021-03-23 10:45:47 <rond_> Definitions for functions operating over non-primitive (i.e. algebraic) values can be
2021-03-23 10:45:48 <rond_> expressed directly in the STG language, and hence do not need to be built in.
2021-03-23 10:45:48 <rond_> That's what I want to say. And in order to be precise, I'd like to make sure I understand the term "algebraic data types" correctly.
2021-03-23 10:47:16 dhil joins (~dhil@80.208.56.181)
2021-03-23 10:47:24 <rond_> So the question is: "Literal of algebraic type" means "an instance of any algebraic data type" or "an instance of algebraic data type that is a boxed representation of a primitive data type"
2021-03-23 10:47:37 aarvar joins (~foewfoiew@2601:602:a080:fa0:49ff:dc3d:e55f:8dd)
2021-03-23 10:49:27 ddellacosta joins (~ddellacos@86.106.143.206)
2021-03-23 10:49:32 stree joins (~stree@68.36.8.116)
2021-03-23 10:49:43 Mrbuck joins (~Mrbuck@gateway/tor-sasl/mrbuck)
2021-03-23 10:49:50 × heatsink quits (~heatsink@2600:1700:bef1:5e10:b09b:3609:dd4b:42c9) (Ping timeout: 264 seconds)
2021-03-23 10:51:59 <rond_> shachaf do you know which one is true? Or do you stand by "it doesn't matter and move on" ?
2021-03-23 10:53:16 <shachaf> My guess is that the one sentence you're quoting is using "literal" in a colloquial sense rather than the sense defined in the paper.
2021-03-23 10:53:43 <rond_> What's the colloquial sense here?
2021-03-23 10:53:45 <shachaf> I think if you run into any specific case where the word "literal" is used, it'll be easy to figure it out in context if it's not that.
2021-03-23 10:53:57 <shachaf> So it's probably not a big deal.
2021-03-23 10:54:12 × ddellacosta quits (~ddellacos@86.106.143.206) (Ping timeout: 256 seconds)
2021-03-23 10:54:24 <shachaf> The colloquial sense is fuzzy, and might include "abc" or might not, etc. -- the idea is just that it's a constant value.
2021-03-23 10:55:34 × Stanley00 quits (~stanley00@unaffiliated/stanley00) (Remote host closed the connection)
2021-03-23 10:56:24 <rond_> I see, however, in immutable language such as Haskell, everything has constant (when eventually computed), right?
2021-03-23 10:56:35 <rond_> has constant value*
2021-03-23 10:57:50 <rond_> anyway, for the purpose of what I'm trying to say I think it'll be sufficient to interpret 'algebraic literal' as 'boxed primitive'
2021-03-23 10:57:50 <peanut_> GHC uses string literals as well
2021-03-23 10:58:56 <rond_> shachaf out of curiosity, how did you end up reading the paper? I thought it's a rather unpopular one\
2021-03-23 10:59:23 <shachaf> "literal" is a syntactic property.
2021-03-23 10:59:41 <shachaf> There's a node in the syntax tree which is an integer value or something.
2021-03-23 11:00:02 <shachaf> I don't know, isn't this paper a classic?
2021-03-23 11:00:06 × olligobber quits (olligobber@gateway/vpn/privateinternetaccess/olligobber) (Remote host closed the connection)
2021-03-23 11:00:11 <shachaf> It's been years since I last looked at it.
2021-03-23 11:01:08 <rond_> Do you have a spare minute to discuss one more thing about this paper?

All times are in UTC.