Newest at the top
2024-11-19 15:34:18 +0100 | <hellwolf> | I bet vscode has it better. |
2024-11-19 15:34:10 +0100 | <hellwolf> | emacs lsp haskell formatting just not ideal, not sure how to fix :/ |
2024-11-19 15:33:51 +0100 | <haskellbridge> | <hellwolf> https://kf8nh.com/_heisenbridge/media/matrix.org/UnZTcaLGKnpftQUaEXKifiUY/SmsNSH3-GDQ/image.png |
2024-11-19 15:30:45 +0100 | <bwe> | dminuoso, mauke, Leary: Thanks for your inputs! |
2024-11-19 15:24:08 +0100 | jinsun | (~jinsun@user/jinsun) jinsun |
2024-11-19 15:22:54 +0100 | jinsun | (~jinsun@user/jinsun) (Ping timeout: 276 seconds) |
2024-11-19 15:21:25 +0100 | mari-estel | (~mari-este@user/mari-estel) mari-estel |
2024-11-19 15:18:53 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) |
2024-11-19 15:14:46 +0100 | <bwe> | dminuoso: wow, I've got it working now. It's magic. |
2024-11-19 15:07:53 +0100 | <dminuoso> | With default implementations of sizeOfP |
2024-11-19 15:07:28 +0100 | <dminuoso> | Though we could conceive a world of having `sizeOf :: Storable s => s -> Int`, `sizeOfP :: Storable s => proxy s -> Int`, `alignment :: Storable s => s -> Int` and `alignmentP :: Storable s => proxy s -> Int` |
2024-11-19 15:05:30 +0100 | <dminuoso> | (Now in this particular example it could be argued, that sizeOf might also be applied to actual values not just undefined at a type) |
2024-11-19 15:04:38 +0100 | <dminuoso> | Something like `sizeOf (Proxy :: Proxy T)` would have been cleaner. |
2024-11-19 15:04:25 +0100 | <dminuoso> | You will find plenty of snippets like `sizeOf (undefined :: T)` in the wild. |
2024-11-19 15:04:11 +0100 | <dminuoso> | bwe: Fun fact, the proxy pattern is what sizeOf in Storable should arguably use. |
2024-11-19 15:02:26 +0100 | <dminuoso> | https://hackage.haskell.org/package/servant-server-0.20.2/docs/Servant-Server.html#t:HasServer |
2024-11-19 15:02:23 +0100 | <dminuoso> | bwe: Take note that this is exactly how servant works its magic: |
2024-11-19 15:01:28 +0100 | <mauke> | (the latter part being equivalent to (Proxy :: Proxy Website)) |
2024-11-19 15:01:16 +0100 | <dminuoso> | i.e. `class FromWebsite a where getNavigationURIs :: proxy a -> [NaviURI]` |
2024-11-19 15:01:05 +0100 | <bwe> | Yes, it is. I omitted functions with `a` which do exist. |
2024-11-19 15:00:52 +0100 | <dminuoso> | That way you could write `getNavigationURIs (Proxy @Website)` |
2024-11-19 15:00:35 +0100 | <dminuoso> | (If thats the intent) |
2024-11-19 15:00:29 +0100 | <dminuoso> | You could add `proxy a` to your methods. |
2024-11-19 15:00:06 +0100 | <dminuoso> | Im not quite sure what the intent is. |
2024-11-19 14:59:54 +0100 | <bwe> | (before switching to Proxy) |
2024-11-19 14:59:40 +0100 | <bwe> | (of a type class) |
2024-11-19 14:59:31 +0100 | <bwe> | dminuoso: here is some more specific example: https://paste.tomsmeding.com/M0BnSi2q |
2024-11-19 14:57:35 +0100 | <dminuoso> | bwe: Out of curiosity, that snippet reads `Proxy 3`, where is that from? |
2024-11-19 14:56:52 +0100 | <dminuoso> | Ah right, infix is for something like `f :+: b` |
2024-11-19 14:56:11 +0100 | <mauke> | :-) |
2024-11-19 14:55:59 +0100 | <dminuoso> | Ah I guess. |
2024-11-19 14:55:56 +0100 | <dminuoso> | circumfix? |
2024-11-19 14:55:51 +0100 | <mauke> | (circumfix) |
2024-11-19 14:55:49 +0100 | <dminuoso> | Where proxy ~ [] |
2024-11-19 14:55:27 +0100 | <dminuoso> | ^- Of course, [Int] is just some infix notation for `[] Int` |
2024-11-19 14:55:14 +0100 | <mauke> | (because proxy = [] for this call) |
2024-11-19 14:54:52 +0100 | <mauke> | e.g. if you take 'proxy a', then f ([] :: [Int]) is a valid use |
2024-11-19 14:54:36 +0100 | <mauke> | bwe: it also means you can define your function without importing Data.Proxy, and if someone already has an expression of the right parameterized type, they can pass that in |
2024-11-19 14:54:26 +0100 | <dminuoso> | bwe: What kind of class are you thinking of? |
2024-11-19 14:54:09 +0100 | <bwe> | how then does my instance type signature look like? |
2024-11-19 14:53:31 +0100 | <[exa]> | Leary: ok great thanks |
2024-11-19 14:53:25 +0100 | <mauke> | bwe: that's because f doesn't actually need to look at the proxy value. it only cares about the type parameter a, so proxy can be free |
2024-11-19 14:53:19 +0100 | ubert | (~Thunderbi@178.115.41.15.wireless.dyn.drei.com) ubert |
2024-11-19 14:53:12 +0100 | <bwe> | dminuoso: https://paste.tomsmeding.com/DGhLoKgV something like this? |
2024-11-19 14:52:50 +0100 | <dminuoso> | hellwolf: Or we just accept the fact that fixity is part of grammars for less clutter. |
2024-11-19 14:52:39 +0100 | <dminuoso> | hellwolf: well we could just toss out all fixity and demand that you write a function signature lik `f :: ((A -> B) -> C) -> D |
2024-11-19 14:52:31 +0100 | <Leary> | Yeah. |
2024-11-19 14:52:02 +0100 | <[exa]> | Leary: oh ok that's a valid point... The Data.Tree is the breadth one, right? (data Tree a = Tree a [Tree a]) |
2024-11-19 14:51:41 +0100 | <dminuoso> | But shouldn'tg that signature read `f :: forall a. A a => a` ? |
2024-11-19 14:51:30 +0100 | <hellwolf> | that's where things get less intuitive for people used to parenthesis being an aid to oprand priority |