Logs: liberachat/#haskell
| 2025-10-30 08:04:25 | × | Sgeo_ quits (~Sgeo@user/sgeo) (Read error: Connection reset by peer) |
| 2025-10-30 08:04:53 | × | bgt32 quits (~keutoi@106.222.232.60) (Ping timeout: 256 seconds) |
| 2025-10-30 08:05:40 | → | Googulator3 joins (~Googulato@2a01-036d-0106-03fa-9dbb-a0af-2124-a319.pool6.digikabel.hu) |
| 2025-10-30 08:05:40 | × | Googulator98 quits (~Googulato@2a01-036d-0106-03fa-9dbb-a0af-2124-a319.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-10-30 08:06:53 | → | bgt32 joins (~keutoi@106.222.233.20) |
| 2025-10-30 08:09:37 | × | Fijxu quits (~Fijxu@user/fijxu) (Ping timeout: 246 seconds) |
| 2025-10-30 08:09:39 | → | srazkvt joins (~sarah@user/srazkvt) |
| 2025-10-30 08:10:00 | × | merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds) |
| 2025-10-30 08:13:56 | → | tromp joins (~textual@2001:1c00:3487:1b00:5978:a504:f2fd:26f) |
| 2025-10-30 08:16:01 | × | trickard quits (~trickard@cpe-52-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 2025-10-30 08:16:16 | → | trickard_ joins (~trickard@cpe-52-98-47-163.wireline.com.au) |
| 2025-10-30 08:19:30 | × | tzh quits (~tzh@c-76-115-131-146.hsd1.or.comcast.net) (Quit: zzz) |
| 2025-10-30 08:20:03 | × | jreicher quits (~user@user/jreicher) (Read error: Connection reset by peer) |
| 2025-10-30 08:20:41 | → | qqe joins (~qqq@185.54.23.200) |
| 2025-10-30 08:22:05 | → | jreicher joins (~user@user/jreicher) |
| 2025-10-30 08:25:41 | × | Googulator3 quits (~Googulato@2a01-036d-0106-03fa-9dbb-a0af-2124-a319.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-10-30 08:25:42 | → | Googulator48 joins (~Googulato@2a01-036d-0106-03fa-9dbb-a0af-2124-a319.pool6.digikabel.hu) |
| 2025-10-30 08:28:59 | → | trickard__ joins (~trickard@cpe-61-98-47-163.wireline.com.au) |
| 2025-10-30 08:29:22 | × | trickard_ quits (~trickard@cpe-52-98-47-163.wireline.com.au) (Ping timeout: 244 seconds) |
| 2025-10-30 08:42:19 | × | trickard__ quits (~trickard@cpe-61-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 2025-10-30 08:42:32 | → | trickard_ joins (~trickard@cpe-61-98-47-163.wireline.com.au) |
| 2025-10-30 08:45:41 | → | Googulator36 joins (~Googulato@2a01-036d-0106-03fa-9dbb-a0af-2124-a319.pool6.digikabel.hu) |
| 2025-10-30 08:45:46 | × | Googulator48 quits (~Googulato@2a01-036d-0106-03fa-9dbb-a0af-2124-a319.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-10-30 08:47:53 | × | emmanuelux quits (~emmanuelu@user/emmanuelux) (Remote host closed the connection) |
| 2025-10-30 08:53:58 | × | trickard_ quits (~trickard@cpe-61-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 2025-10-30 08:54:11 | → | trickard_ joins (~trickard@cpe-61-98-47-163.wireline.com.au) |
| 2025-10-30 08:56:02 | → | kuribas joins (~user@ip-188-118-57-242.reverse.destiny.be) |
| 2025-10-30 08:56:02 | × | connrs quits (~connrs@conners.plus.com) (Read error: Connection reset by peer) |
| 2025-10-30 08:56:04 | → | Googulator11 joins (~Googulato@2a01-036d-0106-03fa-9dbb-a0af-2124-a319.pool6.digikabel.hu) |
| 2025-10-30 08:56:16 | × | Googulator36 quits (~Googulato@2a01-036d-0106-03fa-9dbb-a0af-2124-a319.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-10-30 08:58:34 | → | connrs joins (~connrs@user/connrs) |
| 2025-10-30 08:59:21 | → | merijn joins (~merijn@77.242.116.146) |
| 2025-10-30 09:00:30 | × | ChaiTRex quits (~ChaiTRex@user/chaitrex) (Remote host closed the connection) |
| 2025-10-30 09:00:30 | <kuribas> | Let's say I have a TimeSeries as a functor and applicative, so fmap :: (a -> b) -> TimeSeries a -> TimeSeries b, and <*> :: TimeSeries (a -> b) -> TimeSeries a -> TimeSeries b. Can I lift this into an expression AST, where Fmap :: Formula (a -> b) -> Expr a -> Expr b, App :: Expr (a -> b) -> Expr (b)? |
| 2025-10-30 09:00:40 | × | Googulator11 quits (~Googulato@2a01-036d-0106-03fa-9dbb-a0af-2124-a319.pool6.digikabel.hu) (Client Quit) |
| 2025-10-30 09:00:43 | <kuribas> | Is there an abstraction for this? |
| 2025-10-30 09:00:46 | → | Googulator88 joins (~Googulato@2a01-036d-0106-03fa-9dbb-a0af-2124-a319.pool6.digikabel.hu) |
| 2025-10-30 09:00:54 | → | ChaiTRex joins (~ChaiTRex@user/chaitrex) |
| 2025-10-30 09:01:17 | <kuribas> | Basically I want to describe the timeseries as an abstract expression. |
| 2025-10-30 09:01:48 | <kuribas> | For example, to compile this from a set of expressions to a set database queries. |
| 2025-10-30 09:03:10 | × | qqe quits (~qqq@185.54.23.200) (Quit: Lost terminal) |
| 2025-10-30 09:04:14 | <tomsmeding> | kuribas: sounds like what you're looking for is a free applicative, analogous to a "free monad" for Monad |
| 2025-10-30 09:04:27 | <tomsmeding> | this claims to be one encoding of that https://hackage.haskell.org/package/free-5.2/docs/Control-Applicative-Free.html |
| 2025-10-30 09:05:01 | × | divlamir quits (~divlamir@user/divlamir) (Read error: Connection reset by peer) |
| 2025-10-30 09:05:20 | → | divlamir joins (~divlamir@user/divlamir) |
| 2025-10-30 09:05:34 | <tomsmeding> | but what you wrote would work fine too, I think, as long as 1. you add an `Expr a` field to App, and you add some additional constructor for actual operations to be done |
| 2025-10-30 09:05:56 | <tomsmeding> | (plus some Pure :: a -> Expr a) |
| 2025-10-30 09:08:06 | <kuribas> | tomsmeding: then "f" is the Formula language? |
| 2025-10-30 09:08:21 | <tomsmeding> | with that Control.Applicative.Free? |
| 2025-10-30 09:08:35 | <tomsmeding> | f is your underlying Applicative of operations that you want the expression to be able to perform |
| 2025-10-30 09:08:40 | <tomsmeding> | Ap is the expression language |
| 2025-10-30 09:09:03 | <tomsmeding> | f itself can be an expression language too if you wish to make the whole thing symbolic |
| 2025-10-30 09:10:38 | <tomsmeding> | kuribas: have you seen free monads before? |
| 2025-10-30 09:11:28 | × | Frostillicus quits (~Frostilli@71.174.119.69) (Remote host closed the connection) |
| 2025-10-30 09:11:50 | → | Frostillicus joins (~Frostilli@pool-71-174-119-69.bstnma.fios.verizon.net) |
| 2025-10-30 09:12:54 | × | annamalai quits (~annamalai@2409:4042:2595:bd4d::195e:70b1) (Ping timeout: 256 seconds) |
| 2025-10-30 09:18:01 | <kuribas> | a bit. |
| 2025-10-30 09:18:57 | <kuribas> | So it becomes (data Expr f a)? |
| 2025-10-30 09:19:24 | <kuribas> | Then the abstract version is "Expr Formula a" over some formula language. |
| 2025-10-30 09:19:27 | <tomsmeding> | kuribas: if you want to roll your own, then yes |
| 2025-10-30 09:19:39 | <kuribas> | If I don't? |
| 2025-10-30 09:19:47 | <tomsmeding> | you would use Ap f a :p |
| 2025-10-30 09:20:01 | <tomsmeding> | but if you want to understand what's going on, I do kind of recommend rolling your own |
| 2025-10-30 09:20:10 | <tomsmeding> | it's not hard and makes it more transparent what you're doing precisely |
| 2025-10-30 09:20:28 | <kuribas> | How does my expression language fit in Ap? |
| 2025-10-30 09:20:32 | <tomsmeding> | and then, if you will only ever instantiate f to Formula anyway, you don't even need to parametrise the thing on f |
| 2025-10-30 09:20:40 | <kuribas> | True |
| 2025-10-30 09:20:43 | → | Googulator32 joins (~Googulato@2a01-036d-0106-03fa-9dbb-a0af-2124-a319.pool6.digikabel.hu) |
| 2025-10-30 09:20:45 | × | Googulator88 quits (~Googulato@2a01-036d-0106-03fa-9dbb-a0af-2124-a319.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-10-30 09:20:55 | <tomsmeding> | kuribas: that Ap is a little expression language that expresses fmap, pure and <*> |
| 2025-10-30 09:20:57 | <kuribas> | Though I can have a cheap evaluator to test the language. |
| 2025-10-30 09:21:08 | <tomsmeding> | it doesn't express anything else |
| 2025-10-30 09:21:25 | <tomsmeding> | if you want the language to express anything else than those things, that's what f is for |
| 2025-10-30 09:22:04 | <tomsmeding> | if you want to see _how_ it expresses fmap, pure and <*> (though pure is rather obvious), you can look at the Functor and Applicative instance definitions |
| 2025-10-30 09:22:57 | <tomsmeding> | kuribas: what makes me a little unsure about this is that you use "Formula" for the underlying effect. f is supposed to be some kind of effect; "formula" sounds pure |
| 2025-10-30 09:23:29 | <tomsmeding> | from what you initially said, the standard approach would be to have f describe a database query in some sense |
| 2025-10-30 09:23:57 | <tomsmeding> | then Ap grants you the ability to perform multiple database queries and post-process their results with pure functions |
| 2025-10-30 09:24:16 | <tomsmeding> | all while keeping the individual queries performed available in the Ap data structure as f values |
| 2025-10-30 09:24:20 | → | Fijxu joins (~Fijxu@user/fijxu) |
| 2025-10-30 09:24:45 | <tomsmeding> | now f doesn't need to be an actual "do the query" effect, it could (e.g.) also just be f ~ Const String, where the String is some SQL |
| 2025-10-30 09:25:07 | <tomsmeding> | (I expect you to want more typing than that, but just as an example) |
| 2025-10-30 09:25:51 | <kuribas> | tomsmeding: well, this language is supposed to be pure. |
| 2025-10-30 09:26:02 | <tomsmeding> | then why are you using applicative functors? |
| 2025-10-30 09:26:05 | <kuribas> | Translation to effects and database queries is done as a later step. |
| 2025-10-30 09:26:11 | <tomsmeding> | oh right |
| 2025-10-30 09:26:18 | <kuribas> | because you suggested it? |
| 2025-10-30 09:26:19 | <tomsmeding> | it's a pure language _modelling_ a semantics which has effects |
| 2025-10-30 09:26:31 | <tomsmeding> | kuribas: well you started with Fmap and App :) |
| 2025-10-30 09:26:33 | <kuribas> | well, computation always has effects. |
| 2025-10-30 09:26:43 | <tomsmeding> | 1 + 1 does not, in the sense in which we usually mean it in haskell |
| 2025-10-30 09:26:46 | <kuribas> | But a SQL query is also pure in semantics. |
| 2025-10-30 09:26:50 | <kuribas> | (excluding insert) |
| 2025-10-30 09:27:02 | <tomsmeding> | no, because it depends on the current state of the database, which is external to the program |
| 2025-10-30 09:27:06 | <kuribas> | tomsmeding: indeed |
| 2025-10-30 09:27:31 | <tomsmeding> | okay, I guess it is pure if you consider the DB's state to be internal to the program state, but since we're doing Haskell and it isn't, it makes sense to consider it external here too |
| 2025-10-30 09:27:48 | <tomsmeding> | okay good I now understand what you mean with Formula then |
| 2025-10-30 09:28:07 | <tomsmeding> | a pure, syntactic representation of an effectful query |
| 2025-10-30 09:28:10 | <tomsmeding> | that works |
| 2025-10-30 09:28:39 | <kuribas> | like data Formula a where AddSeries :: Formula (TimeSeries Double -> TimeSeries Double -> TimeSeries Double) |
| 2025-10-30 09:29:00 | × | tromp quits (~textual@2001:1c00:3487:1b00:5978:a504:f2fd:26f) (Quit: My iMac has gone to sleep. ZZZzzz…) |
All times are in UTC.