Newest at the top
2024-04-28 12:14:41 +0200 | <yin> | we can't do that anymore? |
2024-04-28 12:14:26 +0200 | <tomsmeding> | at that point just write a type signature :p |
2024-04-28 12:14:23 +0200 | <ski> | the ` :: [b]' there, specifically |
2024-04-28 12:14:13 +0200 | <ski> | map (f :: a -> b) (xs0 :: [a]) :: [b] = case xs0 of ... |
2024-04-28 12:13:56 +0200 | <yin> | ski: wdym? |
2024-04-28 12:13:46 +0200 | <ski> | .. i miss the ability to put a type ascription on the whole definiendum |
2024-04-28 12:13:21 +0200 | <yin> | forget the | |
2024-04-28 12:13:15 +0200 | <yin> | *i mean |
2024-04-28 12:13:15 +0200 | <tomsmeding> | it's never strictly necessary, but can be very convenient in some cases |
2024-04-28 12:13:13 +0200 | <ski> | the definiendum of the defining equation |
2024-04-28 12:13:13 +0200 | <yin> | i man |
2024-04-28 12:13:12 +0200 | wootehfoot | (~wootehfoo@user/wootehfoot) |
2024-04-28 12:13:02 +0200 | <yin> | or | |
2024-04-28 12:12:59 +0200 | <yin> | tomsmeding: left of the = on a function definition |
2024-04-28 12:12:54 +0200 | <tomsmeding> | a type annotation in a pattern? |
2024-04-28 12:12:47 +0200 | <tomsmeding> | what does "function head" mean? |
2024-04-28 12:12:47 +0200 | <yin> | or is it just a convenience |
2024-04-28 12:12:32 +0200 | <yin> | i guess my question is: do we really need the ability to annotate on the function head? |
2024-04-28 12:09:28 +0200 | wootehfoot | (~wootehfoo@user/wootehfoot) (Read error: Connection reset by peer) |
2024-04-28 12:08:51 +0200 | <tomsmeding> | it's a workaround to be sure |
2024-04-28 12:08:47 +0200 | <tomsmeding> | that helper function could have a type signature from which you can get your type variables with ScopedTypeVariables |
2024-04-28 12:08:34 +0200 | mima | (~mmh@eduroam-pool4-264.wlan.uni-bremen.de) |
2024-04-28 12:08:25 +0200 | <tomsmeding> | you could also write a helper function that you pass your matched things to |
2024-04-28 12:07:19 +0200 | <ski> | "I think it's never actually necessary" -- introducing a type variable for an opened existential |
2024-04-28 12:05:36 +0200 | mima | (~mmh@eduroam-pool4-264.wlan.uni-bremen.de) (Ping timeout: 268 seconds) |
2024-04-28 12:04:09 +0200 | <tomsmeding> | yin: indeed, it's a type annotation that you can put in a convenient spot |
2024-04-28 12:03:52 +0200 | <int-e> | (wrong channel) |
2024-04-28 12:03:45 +0200 | <lambdabot> | -9223372036854775808 |
2024-04-28 12:03:43 +0200 | <yin> | > minBound :: Int |
2024-04-28 12:03:38 +0200 | <yin> | somehow i don't consider that to be patter matching. it's just like |
2024-04-28 12:03:26 +0200 | wootehfoot | (~wootehfoo@user/wootehfoot) |
2024-04-28 12:03:10 +0200 | <int-e> | tomsmeding: oh the cloudatacost.com fan page is gone, so sad. https://web.archive.org/web/20220811231349/https://cloudatacost.com/mystory/original-story-2014 |
2024-04-28 12:02:51 +0200 | <yin> | oh i see |
2024-04-28 12:02:25 +0200 | <tomsmeding> | it's nicer to write `catch _ (\(e :: IOException) -> ...)` |
2024-04-28 12:02:14 +0200 | <tomsmeding> | you typically have to manually constrain e somehow, and having to do that on some occurrence in the body is kind of clunky |
2024-04-28 12:02:08 +0200 | <yin> | yes |
2024-04-28 12:01:54 +0200 | <tomsmeding> | yin: do you see the `(e :: IOException)` in the example in the haddocks? |
2024-04-28 12:01:34 +0200 | <tomsmeding> | so then ghc asks you to say precisely what you mean -- some specific instantiation, or an actual polymorphic type where it's then on you to write down what ghc should do |
2024-04-28 12:01:14 +0200 | <yin> | tomsmeding: where's the type annotation on pattern matching in 'catch'? |
2024-04-28 12:01:00 +0200 | <tomsmeding> | perhaps because the polymorphism is constrained in some weird way |
2024-04-28 12:00:46 +0200 | <tomsmeding> | where ghc sees that your expression is polymorphic, but for some reason (typically a good one in general) it doesn't quite want to just infer that polymorphic type |
2024-04-28 12:00:15 +0200 | <tomsmeding> | right, that's an ambiguity error |
2024-04-28 12:00:09 +0200 | <famubu> | Yeah. |
2024-04-28 11:59:59 +0200 | <famubu> | tomsmeding: 👍 |
2024-04-28 11:59:58 +0200 | <tomsmeding> | famubu: was the error something like "Cannot match type Foo a with Foo a0"? |
2024-04-28 11:59:49 +0200 | <famubu> | [exa]: 🥴 |
2024-04-28 11:59:33 +0200 | <tomsmeding> | famubu: that would be a type equality |
2024-04-28 11:59:06 +0200 | <tomsmeding> | you need that e to infer to something specific, usually, and the body of the lambda is typically not enough for that |
2024-04-28 11:58:49 +0200 | <tomsmeding> | yin: a typical example of (1.) is https://hackage.haskell.org/package/base-4.19.0.0/docs/Control-Exception.html#v:catch |
2024-04-28 11:58:40 +0200 | <famubu> | I'm sure I'm not using the right term here.. |