Logs: freenode/#haskell
| 2021-04-04 15:19:15 | × | stree quits (~stree@68.36.8.116) (Ping timeout: 252 seconds) |
| 2021-04-04 15:25:40 | × | zebrag quits (~inkbottle@aaubervilliers-651-1-244-162.w83-200.abo.wanadoo.fr) (Quit: Konversation terminated!) |
| 2021-04-04 15:25:58 | → | zebrag joins (~inkbottle@aaubervilliers-651-1-244-162.w83-200.abo.wanadoo.fr) |
| 2021-04-04 15:25:59 | × | star_cloud quits (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) (Excess Flood) |
| 2021-04-04 15:26:43 | → | notzmv joins (~zmv@unaffiliated/zmv) |
| 2021-04-04 15:27:15 | → | star_cloud joins (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) |
| 2021-04-04 15:32:02 | → | stree joins (~stree@68.36.8.116) |
| 2021-04-04 15:33:32 | × | MindlessDrone quits (~MindlessD@unaffiliated/mindlessdrone) (Ping timeout: 246 seconds) |
| 2021-04-04 15:38:38 | × | star_cloud quits (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) (Remote host closed the connection) |
| 2021-04-04 15:38:53 | → | star_cloud joins (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) |
| 2021-04-04 15:39:08 | → | MindlessDrone joins (~MindlessD@unaffiliated/mindlessdrone) |
| 2021-04-04 15:39:09 | × | jamm_ quits (~jamm@unaffiliated/jamm) (Remote host closed the connection) |
| 2021-04-04 15:39:48 | → | solvr joins (57e3c46d@87.227.196.109) |
| 2021-04-04 15:41:45 | → | Tario joins (~Tario@201.192.165.173) |
| 2021-04-04 15:43:40 | × | Tario quits (~Tario@201.192.165.173) (Read error: Connection reset by peer) |
| 2021-04-04 15:44:29 | → | Gurkenglas joins (~Gurkengla@unaffiliated/gurkenglas) |
| 2021-04-04 15:44:43 | → | heatsink joins (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-04-04 15:48:39 | × | star_cloud quits (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) (Excess Flood) |
| 2021-04-04 15:49:56 | → | star_cloud joins (~star_clou@ec2-34-220-44-120.us-west-2.compute.amazonaws.com) |
| 2021-04-04 15:50:41 | ← | jakalx parts (~jakalx@base.jakalx.net) () |
| 2021-04-04 15:50:42 | × | dpl quits (~dpl@77-121-78-163.chn.volia.net) (Read error: Connection reset by peer) |
| 2021-04-04 15:57:17 | → | mach1speed joins (~textual@S0106f0b4d2c39cee.va.shawcable.net) |
| 2021-04-04 15:57:45 | → | cheater joins (~user@unaffiliated/cheater) |
| 2021-04-04 15:58:14 | <[exa]> | is it possible to easily specify stuff like "UTF operator-like symbol" or "UTF alphanumeric-like symbol" in alex lexer specification? |
| 2021-04-04 16:00:06 | × | Pressyware[m] quits (pressyware@gateway/shell/matrix.org/x-aixuldvihabgyxzq) (Quit: Idle for 30+ days) |
| 2021-04-04 16:01:06 | <hpc> | you can define your own character sets, but it doesn't look like those are built in |
| 2021-04-04 16:01:20 | <hpc> | so you'd have to list everything in those sets, which is impractical |
| 2021-04-04 16:01:49 | <hpc> | (at least, according to https://www.haskell.org/alex/doc/html/index.html) |
| 2021-04-04 16:03:08 | → | cub3s_ joins (bifunc2@gateway/vpn/protonvpn/bifunc2) |
| 2021-04-04 16:05:01 | × | hive-mind quits (~hivemind@rrcs-67-53-148-69.west.biz.rr.com) (Remote host closed the connection) |
| 2021-04-04 16:05:58 | → | hive-mind joins (~hivemind@rrcs-67-53-148-69.west.biz.rr.com) |
| 2021-04-04 16:06:20 | → | mkDoku joins (~TheMule@aftr-37-201-195-134.unity-media.net) |
| 2021-04-04 16:06:28 | × | Sean1 quits (~Sean@2a02:8071:92ac:1000:91c3:15a4:61c:ab55) (Quit: Leaving) |
| 2021-04-04 16:08:39 | <[exa]> | yeah well, I hoped there'd be some cool undocumented support... :] |
| 2021-04-04 16:09:10 | <[exa]> | I can probably auto-translate the unicode specs to that but that's just as unwieldy and requires modified alex...but I'm likely going to do that anyway |
| 2021-04-04 16:10:59 | <hpc> | ah, that i don't know about |
| 2021-04-04 16:11:30 | <hpc> | depending on how it's implemented in alex, it might be a super easy merge request |
| 2021-04-04 16:12:34 | <hpc> | if the character sets translate directly to haskell's codepoint info, maybe even one or two lines |
| 2021-04-04 16:12:45 | × | howdoi quits (uid224@gateway/web/irccloud.com/x-rljaqugmkkoyqpis) (Quit: Connection closed for inactivity) |
| 2021-04-04 16:16:03 | <[exa]> | it could work on normalized unicode, no idea how to properly react to stuff in denormalized one... |
| 2021-04-04 16:16:17 | <[exa]> | unicode is hard |
| 2021-04-04 16:16:21 | <[exa]> | gonna think about it |
| 2021-04-04 16:17:03 | <[exa]> | anyway `isAlpha` from Data.Char would probably do |
| 2021-04-04 16:17:41 | <[exa]> | (I should just copy the operator code from ghc) |
| 2021-04-04 16:21:06 | <kaol> | Is it possible to write a function f where f 1 x = x, f 2 x = x . x, f 3 x = x . x . x and so on? |
| 2021-04-04 16:22:04 | <hpc> | it is possible, yes |
| 2021-04-04 16:22:35 | → | __monty__ joins (~toonn@unaffiliated/toonn) |
| 2021-04-04 16:23:26 | <hpc> | consider a list where the head is id, and each subsequent element is (x . previous element) |
| 2021-04-04 16:23:32 | <hpc> | and you index into that list |
| 2021-04-04 16:23:35 | <tomsmeding> | kaol: hint: f 2 x = x . x, so f 3 x = x . f 2 x |
| 2021-04-04 16:24:16 | <hpc> | (there's cleaner ways if you take a look through the various modules in base) |
| 2021-04-04 16:25:00 | <dmwit> | how do I upvote documentation |
| 2021-04-04 16:25:00 | <SoF> | > let f n x y = head $ drop n $ iterate x y |
| 2021-04-04 16:25:02 | <lambdabot> | <no location info>: error: |
| 2021-04-04 16:25:02 | <lambdabot> | not an expression: ‘let f n x y = head $ drop n $ iterate x y ’ |
| 2021-04-04 16:25:46 | <SoF> | > let f n x y = head $ drop n $ iterate x y in f 3 (+1) 2 |
| 2021-04-04 16:25:47 | <lambdabot> | 5 |
| 2021-04-04 16:25:50 | <tomsmeding> | SoF: what about 'iterate x y !! n' :p |
| 2021-04-04 16:26:10 | <SoF> | not used to it (yet) |
| 2021-04-04 16:26:12 | <SoF> | but yes lol |
| 2021-04-04 16:26:21 | <kaol> | But what if my f isn't of type a -> a? |
| 2021-04-04 16:26:30 | <SoF> | how would that work then? |
| 2021-04-04 16:26:31 | <hpc> | then you're stuck |
| 2021-04-04 16:26:37 | <tomsmeding> | kaol: what would be the _type_ of your function f then? |
| 2021-04-04 16:27:13 | <kaol> | Aww. lisp could do this for certain. |
| 2021-04-04 16:27:25 | <SoF> | could you give an example? |
| 2021-04-04 16:27:32 | <SoF> | I don't see the logic behind it |
| 2021-04-04 16:27:34 | <tomsmeding> | dynamically-typed lisp? or statically-typed lisp? |
| 2021-04-04 16:28:38 | <maerwald> | isn't all statically typed? |
| 2021-04-04 16:28:56 | <kaol> | I wrote getSum . (foldMap . foldMap . foldMap . foldMap) Sum and I was wondering if I could clean up something with it. |
| 2021-04-04 16:29:10 | <tomsmeding> | maerwald: I wouldn't know, though I do know there's some lispy thing called scheme that's dynamically typed :p |
| 2021-04-04 16:29:14 | <maerwald> | you just overload functions for different types, that's still static |
| 2021-04-04 16:29:47 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2021-04-04 16:29:54 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-04-04 16:30:12 | <dmwit> | kaol: It wouldn't be too hard to write something of type `(f a -> a) -> Many n f a -> a`, where `type family Many n f a where Many Z f a = a; Many (S n) f a = f (Many n f a)`. |
| 2021-04-04 16:30:13 | <hpc> | everything is statically typed for sufficiently broad definition of "type" |
| 2021-04-04 16:30:42 | <maerwald> | dynamically typed would be implicit cast/coersion. Like C |
| 2021-04-04 16:30:45 | → | Tario joins (~Tario@201.192.165.173) |
| 2021-04-04 16:30:49 | <dmwit> | kaol: Then your thing would be something like `getSum . applyMany @(S (S (S (S n)))) foldMap Sum`. |
| 2021-04-04 16:30:55 | × | son0p quits (~son0p@181.136.122.143) (Quit: Lost terminal) |
| 2021-04-04 16:31:09 | → | elliott_ joins (~elliott@pool-108-51-101-42.washdc.fios.verizon.net) |
| 2021-04-04 16:31:11 | <dmwit> | Sorry, `@(S (S (S (S Z))))`, obviously. |
| 2021-04-04 16:32:12 | <dmwit> | I guess `applyMany` would have to have a class constraint I didn't mention in my first message. |
| 2021-04-04 16:32:51 | <kaol> | I don't obviously need that for my code but I was just wondering how one could go about this sort of a thing. |
| 2021-04-04 16:33:52 | <kaol> | An alternate version of that function would be sum . (toList <=< toList <=< toList <=< toList) |
| 2021-04-04 16:34:10 | <tomsmeding> | kaol: because haskell is statically typed, you can only do the thing you mean by 1. explicitly introducing dynamic-typedness (that's possible in haskell too); or 2. introducing _more_ types and fixing the composition count at compile time |
| 2021-04-04 16:34:28 | <tomsmeding> | if you know that number 'n' at compile time, you can make it work |
| 2021-04-04 16:34:31 | samebchase-6 | is now known as samebchase- |
| 2021-04-04 16:34:44 | <tomsmeding> | but not terribly easily |
| 2021-04-04 16:35:05 | <dmwit> | There is a third option. But perhaps you will consider it to fall under a sort of expanded dynamic typing regime. |
| 2021-04-04 16:35:29 | <dmwit> | data SomeMany f a = Zero a | Succ (f (SomeMany f a)) |
| 2021-04-04 16:36:09 | <tomsmeding> | hah, interesting mix of the two |
| 2021-04-04 16:36:09 | <dmwit> | And then `many :: (f a -> a) -> SomeMany f a -> a` is easy to write, isn't obviously dynamically typed, and doesn't fix the composition count at compile time. |
| 2021-04-04 16:36:23 | <dmwit> | yeah =) |
| 2021-04-04 16:36:32 | → | carlomagno joins (~cararell@148.87.23.10) |
| 2021-04-04 16:37:12 | <kaol> | I wasn't even thinking of passing n at run time, just about how to avoid some repetitive typing. |
| 2021-04-04 16:37:48 | <tomsmeding> | dmwit's solution would work |
| 2021-04-04 16:38:18 | <tomsmeding> | given that you can also make it work with ghc's type-level naturals, i.e. getSum . applyMany @4 foldMap Sum |
| 2021-04-04 16:38:38 | <tomsmeding> | can't really remove the @ because ghc isn't dynamically typed :) |
| 2021-04-04 16:38:43 | <tomsmeding> | um |
All times are in UTC.