Logs: freenode/#haskell
| 2020-10-05 18:37:39 | <ski> | | MyRight a |
| 2020-10-05 18:37:42 | <ski> | deriving Show |
| 2020-10-05 18:38:47 | <zoom84> | ok |
| 2020-10-05 18:38:48 | <ski> | so, in the current situation, with `fmap :: (a -> b) -> MyEither doodad a -> MyEither doodad b', and `MyLeft x :: MyEither doodad a' .. there is no `dog' (nor `cat'). so "so it's dog, correct ?" is wrong |
| 2020-10-05 18:39:10 | <zoom84> | so the question posed to me is still, what's the type of x, right? |
| 2020-10-05 18:39:12 | <ski> | you have to answer in terms of the available type variables, in the current situation, which are : `doodad',`a',`b' |
| 2020-10-05 18:39:16 | <ski> | yes |
| 2020-10-05 18:39:56 | <zoom84> | then i don't know. because I guess the entire vernacular of what's being referred to as a type confuses me |
| 2020-10-05 18:40:04 | <zoom84> | based on my reading of haskell, the only type here is MyEither |
| 2020-10-05 18:40:18 | <zoom84> | MyLeft and MyRight are constructors for that type |
| 2020-10-05 18:40:34 | <zoom84> | but irrespective of whether an instance is MyRight or MyLeft, the type is still MyEither |
| 2020-10-05 18:40:42 | <ski> | `MyEither' is a type, `MyEither doodad a' and `MyEither doodad b' are also types, as are `a -> b',`a',`b',`doodad' (all type variables are types) |
| 2020-10-05 18:40:45 | <zoom84> | unless my understanding of what we're calling a type is wrong |
| 2020-10-05 18:42:13 | → | snakemasterflex joins (~snakemast@213.100.206.23) |
| 2020-10-05 18:42:21 | <ski> | saying `MyLeft x :: MyEither doodad a' means that the (pattern / formal parameter) `MyLeft x' has type `MyEither doodad a' |
| 2020-10-05 18:42:36 | <ski> | (so `MyEither doodad a' is a type. otherwise `MyLeft x' couldn't have it as type) |
| 2020-10-05 18:43:11 | <ski> | what you're doing, when pattern-matching (which is a generalization of destructuring), is that you're going "backwards" |
| 2020-10-05 18:43:18 | <zoom84> | you're saying MyEither doodad a is a type distinct from MyEither? |
| 2020-10-05 18:43:28 | <ski> | yes |
| 2020-10-05 18:43:39 | <ski> | `MyEither doodad a' is a "concrete" type |
| 2020-10-05 18:43:46 | <ski> | it makes sense to say e.g |
| 2020-10-05 18:43:55 | <ski> | MyLeft x :: MyEither doodad a |
| 2020-10-05 18:44:15 | <zoom84> | yeah, that's another point of confusion for me. the fact that a parameterized var can be considered concrete |
| 2020-10-05 18:44:19 | <ski> | "concrete" types are those types that are types of values |
| 2020-10-05 18:44:29 | <dolio> | That seems like a bad name for them. |
| 2020-10-05 18:44:35 | <ski> | "concrete" doesn't mean "specific" |
| 2020-10-05 18:44:50 | <ski> | yea, sometimes people trip up over this distinction |
| 2020-10-05 18:44:58 | × | Franciman quits (~francesco@host-212-171-42-250.retail.telecomitalia.it) (Ping timeout: 265 seconds) |
| 2020-10-05 18:45:02 | <zoom84> | ok, good. because this was another point of confusion to me that feed into this |
| 2020-10-05 18:45:15 | <zoom84> | so MyEither doodad a is concrete |
| 2020-10-05 18:45:25 | <ski> | `doodad' and `a' are type variables. that mean that we don't have any specific types in mind (like `Int' or `[Bool]', ..), when we write them |
| 2020-10-05 18:45:30 | <zoom84> | what does that make MyEither Int or MyEither String? |
| 2020-10-05 18:45:38 | → | kritzefitz joins (~kritzefit@212.86.56.80) |
| 2020-10-05 18:45:59 | → | devalot joins (~ident@mail.pmade.com) |
| 2020-10-05 18:46:25 | <zoom84> | is there a name for MyEither Int vs MyEither doodad...to help me grasp the nomenclature |
| 2020-10-05 18:46:49 | <ski> | so, what we mean when we say that `MyEither doodad a' is a concrete type is actually : if we'd replace `doodad' and `a' with specific (concete) types, then the result of that replacement on `MyEither doodad a' will be a concrete type |
| 2020-10-05 18:47:05 | <zoom84> | ok, understood on that point |
| 2020-10-05 18:47:14 | <zoom84> | so it's a pathway to a concrete type |
| 2020-10-05 18:47:20 | <ski> | e.g. since `Int' and `[Bool]' are specific (concrete) types, `MyEither Int [Bool]' is a concrete (specific) type |
| 2020-10-05 18:47:51 | <ski> | however, it gets long-winded to all the time say that "if we replace the type variables with specific types, then .." part all the time |
| 2020-10-05 18:48:25 | × | knupfer quits (~Thunderbi@200116b82cef830020ab55033e39ebbd.dip.versatel-1u1.de) (Ping timeout: 240 seconds) |
| 2020-10-05 18:48:27 | <zoom84> | ok, so what's an example of a non-concrete type in this specific context |
| 2020-10-05 18:48:43 | <ski> | it's like when saying that `x + 1' is a number. we really mean here : if `x' is replaced by a number, then `x + 1' will become (an expression for) a number |
| 2020-10-05 18:49:04 | <ski> | `MyEither' is not concrete |
| 2020-10-05 18:49:09 | <ski> | it doesn't make sense to say |
| 2020-10-05 18:49:14 | <ski> | blah :: MyEither |
| 2020-10-05 18:49:31 | <ski> | `MyEither' is "incomplete" on its own, it's a "template" that's missing it's parameters |
| 2020-10-05 18:49:32 | <zoom84> | ok, so MyEither is non-concrete because it doesn't establish which specific constructor would be referenced |
| 2020-10-05 18:49:59 | <ski> | you have to say `MyEither T U', for some specific types `T' and `U', to get a concrete type |
| 2020-10-05 18:50:01 | <zoom84> | but the constructors themselves are concrete because they have placeholders which lead to concrete types |
| 2020-10-05 18:51:01 | <ski> | you have to distinguish between two different "levels". "value level" where values (including functions) live, and interact. and "type level" where types (including non-concrete types) live |
| 2020-10-05 18:51:35 | <ski> | the data constructors `MyLeft' and `MyRight' live on the "value level". they are functions. we in fact have : |
| 2020-10-05 18:51:41 | <ghoulguy> | ski: are you using "concrete" as a stand-in for "has kind *"? |
| 2020-10-05 18:51:52 | <ski> | MyLeft :: dog -> MyEither dog cat |
| 2020-10-05 18:51:59 | <ski> | MyRight :: cat -> MyEither dog cat |
| 2020-10-05 18:52:05 | <dolio> | Yeah, I've never heard this terminology before. |
| 2020-10-05 18:52:08 | → | oisdk joins (~oisdk@2001:bb6:3329:d100:189f:9172:61d6:2b9e) |
| 2020-10-05 18:52:16 | <ski> | ghoulguy : almost. i'm also using it to gloss over unboxed stuff, &c. |
| 2020-10-05 18:52:51 | <ski> | (which part of the terminology ?) |
| 2020-10-05 18:53:19 | <zoom84> | i think i get it SKI. the abstractness here is what throws me off. In my C world view, haskell's "data" created types are what I would implement as unions in C, which a hidden enum field describing which of the type constructors were used. it's probably not useful for me to relate this to C |
| 2020-10-05 18:53:27 | <dolio> | Using "concrete" in this way. |
| 2020-10-05 18:53:48 | <zoom84> | but I'll table that C comparison because it's not useful |
| 2020-10-05 18:54:16 | <ski> | zoom84 : in C, you can't really have "an array". it's always "an array of something". if you say you have an array, you really mean an array with elements of some particular type |
| 2020-10-05 18:54:53 | <ski> | zoom84 : saying `blah :: MyEither' is like trying to say `blah' is an array (rather than an array of something) |
| 2020-10-05 18:55:12 | → | is_null joins (~jpic@pdpc/supporter/professional/is-null) |
| 2020-10-05 18:55:40 | <hc> | zoom84: actually that comparison if not bad... :) |
| 2020-10-05 18:55:42 | <ski> | "array" is a parameterized type, in C. (as is "pointer", it's always "pointer to something"). in Haskell, you can define your own parameterized types |
| 2020-10-05 18:56:27 | hackage | uniqueness-periods-vector-examples 0.8.0.0 - Usage examples for the uniqueness-periods-vector series of packages https://hackage.haskell.org/package/uniqueness-periods-vector-examples-0.8.0.0 (OleksandrZhabenko) |
| 2020-10-05 18:57:07 | → | sep2 joins (49dc4892@c-73-220-72-146.hsd1.ca.comcast.net) |
| 2020-10-05 18:57:16 | <zoom84> | data MyEither dog cat = MyLeft dog | Myright catstruct { enum { DOG, CAT } type; union { int dog; int cat; }} |
| 2020-10-05 18:57:25 | <dolio> | I think "saturated" might be a better word. |
| 2020-10-05 18:57:27 | hackage | porpoise 0.1.0.0 - A minimalist HTTP server framework written on top of wai https://hackage.haskell.org/package/porpoise-0.1.0.0 (sgschlesinger) |
| 2020-10-05 18:57:40 | → | Guest75545 joins (~Fare@178.162.204.214) |
| 2020-10-05 18:57:47 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2020-10-05 18:58:15 | <zoom84> | ok, so MyEither is a type. MyLeft is also considered a type, but a concrete one. is that recap correct? |
| 2020-10-05 18:58:17 | <monochrom> | I think this is trying to explain kinds without explaining kinds. |
| 2020-10-05 18:58:17 | <hc> | zoom84: sounds about right; but you'd need a parametrized macro to expand the doc and cat types |
| 2020-10-05 18:58:21 | <sep2> | What would be the best way to even get started with this one, a one-liner or do a function for each instance being empty? https://dpaste.org/ZQ2h |
| 2020-10-05 18:58:43 | <dolio> | monochrom: Well, yeah. |
| 2020-10-05 18:58:45 | <ski> | zoom84 : anyway, `MyEither dog cat' is comparable to "array of `N' `int's" in C (which could be written `int[N]'). in both cases we have supplied (two) parameters |
| 2020-10-05 18:58:53 | <monochrom> | But it is a really long story, I don't have a better suggestion. |
| 2020-10-05 18:58:59 | × | Jesin quits (~Jesin@pool-72-66-101-18.washdc.fios.verizon.net) (Quit: Leaving) |
| 2020-10-05 18:59:08 | <ski> | zoom84 : not quite. `MyLeft' and `MyRight' are not types. they're values (specifically they're `data' constructors) |
| 2020-10-05 18:59:19 | × | nbloomf quits (~nbloomf@2600:1700:83e0:1f40:bd24:9726:f60a:ba09) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2020-10-05 18:59:50 | <ski> | MyLeft :: dog -> MyEither dog cat |
| 2020-10-05 18:59:51 | <ski> | MyRight :: cat -> MyEither dog cat |
| 2020-10-05 18:59:53 | <zoom84> | Ok. MyEither is a type. MyLeft and MyRight are value constructors, which create concrete types of MyEither. is that right? |
| 2020-10-05 18:59:54 | <monochrom> | Well, I have a prelim one I use in my class. I start with Maybe Int and [] Int and I say "now you can have a type class for the Maybe-ness without Int, the []-ness without Int". |
| 2020-10-05 19:00:02 | <hc> | zoom84: that's right |
| 2020-10-05 19:00:21 | <zoom84> | are they called value constructors or is the correct term, type constructors? |
| 2020-10-05 19:00:21 | × | conal quits (~conal@64.71.133.70) (Quit: Computer has gone to sleep.) |
| 2020-10-05 19:00:52 | → | nbloomf joins (~nbloomf@2600:1700:83e0:1f40:8115:8d3a:8e30:e79f) |
| 2020-10-05 19:00:55 | <hc> | This is a type constructor, because you get a type and not a value back |
| 2020-10-05 19:01:01 | <ghoulguy> | constructor is a class of names, the capital first letter gives away that it's a constructor here |
| 2020-10-05 19:01:39 | <ski> | zoom84 : `MyLeft' and `MyRight' are functions, like any other functions. you can apply them to an input (of the correct type, as always). the difference with ordinary functions are (a) you can pattern-match on them, "running them backwards"; (b) they don't actually do/compute anything, except storing their parameters so that you can later match and get them back |
| 2020-10-05 19:01:56 | × | idhugo quits (~idhugo@563472ae.rev.stofanet.dk) (Ping timeout: 256 seconds) |
| 2020-10-05 19:02:37 | <zoom84> | ok, understood. so what's the entity called that's created say "MyLeft 50"? I would consider it an instance of a type in other languges |
| 2020-10-05 19:02:37 | <ski> | dolio : i think the "concrete" terminology has floated around this channel, for many years |
| 2020-10-05 19:02:55 | <ski> | zoom84 : it's also a value. a value of type `MyEither Int Double' (e.g.) |
| 2020-10-05 19:02:55 | × | berberman_ quits (~berberman@2408:8207:256e:d930:584e:a9ff:fe9b:d3fe) (Ping timeout: 240 seconds) |
All times are in UTC.