Logs: freenode/#haskell
| 2020-09-17 08:44:55 | <kuribas> | then what's the confusion |
| 2020-09-17 08:44:58 | <kuribas> | ? |
| 2020-09-17 08:45:40 | → | gestone joins (~gestone@c-73-97-137-216.hsd1.wa.comcast.net) |
| 2020-09-17 08:46:16 | → | asan joins (~yan4138@124.78.128.72) |
| 2020-09-17 08:46:21 | × | cmcma20 quits (~cmcma20@l37-192-3-172.novotelecom.ru) (Quit: leaving) |
| 2020-09-17 08:46:32 | <bahamas> | kuribas: well, how would you define an expression? my intuition tells me that an expression gives you a value. intuitively, function application is an expression, because the function returns a value |
| 2020-09-17 08:46:41 | <bahamas> | however, in what way is a variable an expression? |
| 2020-09-17 08:47:04 | <kuribas> | a variable gives you a value as well |
| 2020-09-17 08:47:17 | <kuribas> | > let x = 1 in x |
| 2020-09-17 08:47:18 | <[exa]> | bahamas: "represents" a value is better naming here I guess. |
| 2020-09-17 08:47:20 | <lambdabot> | 1 |
| 2020-09-17 08:47:24 | <lortabac> | kuribas: alternatively, you can define three different types with the same field names and use GHC.Records.HasField or lenses to regain the ability to define generic operations over the 3 types |
| 2020-09-17 08:47:33 | <bahamas> | and a constructor? a constructor, not a constructor application |
| 2020-09-17 08:47:45 | × | vicfred_ quits (~vicfred@unaffiliated/vicfred) (Quit: Leaving) |
| 2020-09-17 08:47:51 | <[exa]> | bahamas: Nothing is a value right? |
| 2020-09-17 08:47:57 | <kuribas> | bahamas: a constructor is a function |
| 2020-09-17 08:48:06 | <bahamas> | and a function is a value |
| 2020-09-17 08:48:23 | <bahamas> | what is wrong with saying that identifiers are expressions? |
| 2020-09-17 08:48:32 | <[exa]> | nothing? :] |
| 2020-09-17 08:48:34 | → | Katarushisu joins (~Katarushi@cpc149712-finc20-2-0-cust535.4-2.cable.virginm.net) |
| 2020-09-17 08:48:43 | <kuribas> | an identifier is a syntactic construct |
| 2020-09-17 08:48:57 | <kuribas> | it depends on the context if it's a value |
| 2020-09-17 08:49:23 | → | stiell joins (~stian@fsf/member/stiell) |
| 2020-09-17 08:50:20 | × | gestone quits (~gestone@c-73-97-137-216.hsd1.wa.comcast.net) (Ping timeout: 260 seconds) |
| 2020-09-17 08:50:50 | <lortabac> | kuribas: in my experience having different types is in most cases less annoying than dealing with the type families |
| 2020-09-17 08:51:02 | → | rapskalian joins (~user@2601:804:8400:5750:6d07:cb01:64a9:36bb) |
| 2020-09-17 08:51:14 | <kuribas> | lortabac: yeah, I guess you're right |
| 2020-09-17 08:51:16 | <bahamas> | kuribas: ok. I think I know what you mean. |
| 2020-09-17 08:51:46 | <kuribas> | lortabac: I find duplicateRecordFields and recordWildcards quite handy :) |
| 2020-09-17 08:53:12 | <kuribas> | "let x = 2", the x is not an expression here, it's a variable binding. |
| 2020-09-17 08:53:13 | <dminuoso> | bahamas: There's two connected notions of an expression: a) something that can be evaluated b) a grammatical production rule - the latter gives you all syntactical trees of evaluatable fragments |
| 2020-09-17 08:53:55 | → | Lycurgus joins (~niemand@98.4.96.130) |
| 2020-09-17 08:54:49 | <bahamas> | dminuoso: can you give an example of the second? |
| 2020-09-17 08:55:28 | hackage | postgresql-binary 0.12.3.1 - Encoders and decoders for the PostgreSQL's binary format https://hackage.haskell.org/package/postgresql-binary-0.12.3.1 (NikitaVolkov) |
| 2020-09-17 08:55:39 | <kuribas> | bahamas: also you are asking how to define an expression, but that page defines an expression exactly :) I guess you don't want a definition, but an intuition |
| 2020-09-17 08:56:06 | × | rapskalian quits (~user@2601:804:8400:5750:6d07:cb01:64a9:36bb) (Ping timeout: 244 seconds) |
| 2020-09-17 08:56:09 | <dminuoso> | bahamas: exp -> infixexp :: [context =>] type | infixexp |
| 2020-09-17 08:56:19 | <dminuoso> | Is the topmost production rule for an expression in Haskell |
| 2020-09-17 08:56:28 | hackage | wai-extra 3.0.30 - Provides some basic WAI handlers and middleware. https://hackage.haskell.org/package/wai-extra-3.0.30 (MichaelSnoyman) |
| 2020-09-17 08:57:19 | <dminuoso> | If you follow this down a bit, you'll end up with a production rule `aexp -> qvar | gcon | literal | ( exp ) | ...` |
| 2020-09-17 08:59:30 | <dminuoso> | Roughly, you can think of Haskell evaluation as being a graph reduction machine on a haskell expression graph/tree. |
| 2020-09-17 09:00:02 | × | AstroDroid quits (~AstroDroi@84.39.117.57) () |
| 2020-09-17 09:00:13 | <dminuoso> | (Taking expressions to expressions) |
| 2020-09-17 09:00:56 | × | reed[m] quits (reedriotfi@gateway/shell/matrix.org/x-zlxtwltpfmittewe) (Quit: Idle for 30+ days) |
| 2020-09-17 09:01:00 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-09-17 09:02:37 | → | cosimone joins (~cosimone@2001:b07:ae5:db26:b248:7aff:feea:34b6) |
| 2020-09-17 09:06:32 | → | gestone joins (~gestone@c-73-97-137-216.hsd1.wa.comcast.net) |
| 2020-09-17 09:09:28 | → | akegalj joins (~akegalj@93-136-206-221.adsl.net.t-com.hr) |
| 2020-09-17 09:10:43 | × | ChaiTRex quits (~ChaiTRex@gateway/tor-sasl/chaitrex) (Ping timeout: 240 seconds) |
| 2020-09-17 09:10:45 | × | gestone quits (~gestone@c-73-97-137-216.hsd1.wa.comcast.net) (Ping timeout: 240 seconds) |
| 2020-09-17 09:11:10 | → | dyeplexer joins (~lol@unaffiliated/terpin) |
| 2020-09-17 09:12:18 | → | ChaiTRex joins (~ChaiTRex@gateway/tor-sasl/chaitrex) |
| 2020-09-17 09:12:20 | <kuribas> | how would you ensure a lazy language is total? |
| 2020-09-17 09:13:26 | <kuribas> | :t fix |
| 2020-09-17 09:13:27 | <lambdabot> | (a -> a) -> a |
| 2020-09-17 09:14:18 | <phadej> | fix isn't something you have to add to a language |
| 2020-09-17 09:14:20 | <kuribas> | is there a fix-like function that doesn't diverge? |
| 2020-09-17 09:14:23 | <Lycurgus> | by disregarding laziness as nothing more than a lang feature? |
| 2020-09-17 09:14:37 | <bahamas> | dminuoso: does that mean that an expression's type signature is also an expression? |
| 2020-09-17 09:14:48 | <dminuoso> | bahamas: There's an easy test: |
| 2020-09-17 09:14:53 | <dminuoso> | bahamas: Go through the production rules |
| 2020-09-17 09:15:02 | × | jzl quits (~jzl@unaffiliated/jzl) (Ping timeout: 256 seconds) |
| 2020-09-17 09:15:10 | <kuribas> | bahamas: you can consider it a "type level expression" |
| 2020-09-17 09:15:30 | <kuribas> | bahamas: however it isn't a value, it's a type. |
| 2020-09-17 09:15:33 | × | jedws quits (~jedws@101.184.189.58) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2020-09-17 09:15:35 | <dminuoso> | bahamas: You'd need something like `aexp -> type | ...` |
| 2020-09-17 09:15:40 | <dminuoso> | (or possibly not aexp, but you get the idea) |
| 2020-09-17 09:15:55 | <dminuoso> | If such a production does not exist, then formally, a type is not an expression. |
| 2020-09-17 09:16:13 | <dminuoso> | However, you can see it can be *part* of expressions, namely by the production rule: |
| 2020-09-17 09:16:17 | <dminuoso> | exp -> infixexp :: [context =>] type |
| 2020-09-17 09:16:34 | <kuribas> | Lycurgus: recursion can be total by ensuring the recursive step is smaller. But can you do the same with lazyness? |
| 2020-09-17 09:17:16 | <kuribas> | Lycurgus: perhaps if the return of (a -> a) is smaller than the input? |
| 2020-09-17 09:18:34 | <kuribas> | hmm, no because x = tail x still diverges... |
| 2020-09-17 09:20:16 | <bahamas> | dminuoso: ok. all that recursion and the use of the name "infixexp" is confusing me a bit, but if I'm unpacking those terms, it's slowly falling into place |
| 2020-09-17 09:20:19 | <bahamas> | thanks |
| 2020-09-17 09:20:37 | <Lycurgus> | is laziness modeled as part of the active semantics of haskell? that's why I said what I did, that laziness is is between a compiler feature and the execution semantics |
| 2020-09-17 09:20:45 | <dminuoso> | bahamas: Read a production `foo -> bar` as "to make a foo, use bar" |
| 2020-09-17 09:20:57 | <dminuoso> | (It's why they are called production rules, they tell you how to *produce* the left hand side) |
| 2020-09-17 09:21:02 | <kuribas> | Lycurgus: yes it is |
| 2020-09-17 09:21:04 | <Lycurgus> | an if you only consider the latter then laziness can be disregarded |
| 2020-09-17 09:21:41 | <kuribas> | Lycurgus: because bottom is part of the semantics, and lazyness changes the result when bottom is present. |
| 2020-09-17 09:21:51 | <Lycurgus> | which is sort of cognitively consistent with a lang with the hubris or what ever to have ct as a model of computation |
| 2020-09-17 09:21:55 | <dminuoso> | bahamas: And they are exhaustive. So if there's no production rule for some `f -> g`, then g does not make an f |
| 2020-09-17 09:21:57 | → | blardo joins (~blardo@185.244.214.216) |
| 2020-09-17 09:22:00 | → | ph88^ joins (~ph88@ip5f5af726.dynamic.kabel-deutschland.de) |
| 2020-09-17 09:22:42 | <kuribas> | > foldr const 1 (1:undefined) |
| 2020-09-17 09:22:45 | <lambdabot> | 1 |
| 2020-09-17 09:22:56 | × | cosimone quits (~cosimone@2001:b07:ae5:db26:b248:7aff:feea:34b6) (Quit: Quit.) |
| 2020-09-17 09:22:56 | <kuribas> | Lycurgus: that would be bottom in a strict language |
| 2020-09-17 09:23:07 | <kuribas> | Lycurgus: haskell ensures it's 1 |
| 2020-09-17 09:23:27 | <Lycurgus> | well i gave an easy and gordian way |
| 2020-09-17 09:23:40 | <Lycurgus> | i suppose that's not the hs way tho |
| 2020-09-17 09:24:02 | → | cosimone joins (~cosimone@2001:b07:ae5:db26:b248:7aff:feea:34b6) |
| 2020-09-17 09:24:07 | → | acidjnk_new3 joins (~acidjnk@p200300d0c736587164f46f145ae9b6a7.dip0.t-ipconnect.de) |
| 2020-09-17 09:24:29 | → | ph88_ joins (~ph88@2a02:8109:9e40:2704:85f2:8dce:6e30:a554) |
| 2020-09-17 09:24:44 | <lortabac> | kuribas: Agda is an example of a lazy total language |
| 2020-09-17 09:25:14 | <lortabac> | maybe you can find some answers in the author's Phd thesis |
| 2020-09-17 09:25:33 | × | ph88 quits (~ph88@2a02:8109:9e40:2704:6cf2:c517:5b95:5f99) (Ping timeout: 272 seconds) |
| 2020-09-17 09:27:03 | × | mirrorbird quits (~psutcliff@2a00:801:44b:8959:8d6c:276b:332b:1c71) (Quit: Leaving) |
| 2020-09-17 09:27:21 | → | gestone joins (~gestone@c-73-97-137-216.hsd1.wa.comcast.net) |
All times are in UTC.