Logs: freenode/#haskell
| 2020-11-26 07:46:55 | → | n0042 joins (d055ed89@208.85.237.137) |
| 2020-11-26 07:47:07 | <MarcelineVQ> | what would cale do |
| 2020-11-26 07:47:25 | <asheshambasta> | Anyone with more reflex experience than I can tell me why this traces: https://github.com/asheshambasta/flowerpower/blob/showcase/servant-reflex-dependency/fht-frontend/src/Frontend/Garden/Plant.hs#L93 while this doesn't: https://github.com/asheshambasta/flowerpower/blob/showcase/servant-reflex-dependency/fht-frontend/src/Frontend/Garden/Plant.hs#L103 (I couldn't provide a more minimal repro. of this) |
| 2020-11-26 07:47:59 | <jle`> | looks like `traverse sequence` |
| 2020-11-26 07:48:44 | <dminuoso> | traverse (sequence . swap) |
| 2020-11-26 07:48:50 | <koz_> | :t traverse sequence |
| 2020-11-26 07:48:51 | <lambdabot> | (Traversable t1, Traversable t2, Monad f) => t1 (t2 (f a)) -> f (t1 (t2 a)) |
| 2020-11-26 07:48:54 | <dminuoso> | % :t traverse (sequence . swap |
| 2020-11-26 07:48:54 | <yahb> | dminuoso: ; <interactive>:1:26: error: parse error (possibly incorrect indentation or mismatched brackets) |
| 2020-11-26 07:48:56 | <dminuoso> | % :t traverse (sequence . swap) |
| 2020-11-26 07:48:56 | <yahb> | dminuoso: forall {t :: * -> *} {f :: * -> *} {a} {b}. (Traversable t, Monad f) => t (f a, b) -> f (t (b, a)) |
| 2020-11-26 07:49:12 | <dminuoso> | Oh, no. Actually traverse sequence right |
| 2020-11-26 07:50:07 | <jle`> | traverse (sequence . swap . swap) |
| 2020-11-26 07:50:28 | <dminuoso> | :) |
| 2020-11-26 07:50:33 | × | gioyik quits (~gioyik@186.118.238.251) (Quit: WeeChat 3.0) |
| 2020-11-26 07:51:26 | × | robotmay quits (~beepboop@80.172.187.81.in-addr.arpa) (Remote host closed the connection) |
| 2020-11-26 07:51:40 | <dminuoso> | traverse (sequence . swap . flip const id . swap) |
| 2020-11-26 07:52:15 | <dminuoso> | Bet hlint cant figure that one out. |
| 2020-11-26 07:52:33 | <koz_> | :t flip const id |
| 2020-11-26 07:52:34 | <lambdabot> | c -> c |
| 2020-11-26 07:52:39 | <koz_> | Lol. |
| 2020-11-26 07:52:55 | <jle`> | :t const id () |
| 2020-11-26 07:52:56 | <lambdabot> | a -> a |
| 2020-11-26 07:53:47 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2020-11-26 07:54:02 | <incertia> | i had to think about flip const id for a bit |
| 2020-11-26 07:54:22 | <dminuoso> | Well you can put something more interesting into `id`, that is better for tripping you up |
| 2020-11-26 07:54:25 | <dminuoso> | like `flip const fmap` |
| 2020-11-26 07:54:48 | <jle`> | :t const id id |
| 2020-11-26 07:54:49 | <lambdabot> | a -> a |
| 2020-11-26 07:54:58 | → | robotmay joins (~beepboop@2001:8b0:7af0:2580:888:72a9:4a8e:aea0) |
| 2020-11-26 07:55:04 | <dminuoso> | % :t flip const fmap |
| 2020-11-26 07:55:05 | <yahb> | dminuoso: ; <interactive>:1:12: error:; * Ambiguous type variable `f0' arising from a use of `fmap'; prevents the constraint `(Functor f0)' from being solved.; Probable fix: use a type annotation to specify what `f0' should be.; These potential instances exist:; instance [safe] forall a. Functor (Q.Fun a) -- Defined in `Test.QuickCheck.Function'; instance [safe] Functor Q.Gen |
| 2020-11-26 07:55:12 | <dminuoso> | Oh. wait what? |
| 2020-11-26 07:55:20 | <jle`> | it doesn't know what Functor instance to compile there |
| 2020-11-26 07:55:31 | <jle`> | :t flip const map |
| 2020-11-26 07:55:33 | <lambdabot> | c -> c |
| 2020-11-26 07:55:46 | <dminuoso> | Oh I guess this would need impredicative types? |
| 2020-11-26 07:56:01 | <incertia> | asheshambasta: i would imagine it wouldn't get traced if dEitherPlant is Left |
| 2020-11-26 07:56:08 | <dminuoso> | yeah `flip const map` it is |
| 2020-11-26 07:56:15 | → | sdx23 joins (~sdx23@unaffiliated/sdx23) |
| 2020-11-26 07:56:16 | <incertia> | could be wrong here |
| 2020-11-26 07:56:18 | <jle`> | flip const map itself only works because of defaulting i think |
| 2020-11-26 07:56:30 | <dminuoso> | Why defaulting? |
| 2020-11-26 07:56:33 | <dminuoso> | % :t flip const |
| 2020-11-26 07:56:34 | <yahb> | dminuoso: forall {b} {c}. b -> c -> c |
| 2020-11-26 07:56:43 | <jle`> | because it defaults to map :: (() -> ()) -> [()] -> [()] |
| 2020-11-26 07:56:44 | → | raichoo joins (~raichoo@dslb-092-073-219-149.092.073.pools.vodafone-ip.de) |
| 2020-11-26 07:56:58 | <jle`> | otherwise it wouldn't know what to pick for a and b |
| 2020-11-26 07:56:59 | <jle`> | :t map |
| 2020-11-26 07:57:00 | <dminuoso> | Ah, I see. Otherwise that would have required impredicativity |
| 2020-11-26 07:57:01 | <lambdabot> | (a -> b) -> [a] -> [b] |
| 2020-11-26 07:57:26 | <incertia> | in particular if any of eName or eDayPlanted are Left it would cause fst <$> maints/snd <$> maints to not be evaluated and thus not trigger the traceEvent |
| 2020-11-26 07:57:28 | <incertia> | but im no guru |
| 2020-11-26 07:57:34 | <jle`> | there should be defaulting for * -> *'s |
| 2020-11-26 07:57:53 | × | Varis quits (~Tadas@unaffiliated/varis) (Remote host closed the connection) |
| 2020-11-26 07:58:00 | <dminuoso> | You should open an issue on gitlab about that. Name `flip const fmap` as the motivating example. |
| 2020-11-26 07:58:12 | dminuoso | smiles |
| 2020-11-26 07:58:13 | <jle`> | bites me every day :) |
| 2020-11-26 07:58:24 | <jle`> | i wonder what the default should be |
| 2020-11-26 07:58:34 | <jle`> | maybe Identity first? |
| 2020-11-26 07:58:41 | <jle`> | or maybe Proxy |
| 2020-11-26 07:58:48 | <jle`> | ah yeah, Proxy first, then Identity |
| 2020-11-26 07:59:17 | <jle`> | this would be my dream haskell |
| 2020-11-26 07:59:54 | <incertia> | when i learned about Proxy my entire world changed |
| 2020-11-26 07:59:57 | <koz_> | :t flip const map |
| 2020-11-26 07:59:59 | <lambdabot> | c -> c |
| 2020-11-26 08:00:03 | <koz_> | LOL |
| 2020-11-26 08:00:18 | → | cfricke joins (~cfricke@unaffiliated/cfricke) |
| 2020-11-26 08:00:26 | <dminuoso> | I think I should get three points for tripping koz_ up twice in a row. |
| 2020-11-26 08:00:40 | <incertia> | that and DataKinds |
| 2020-11-26 08:00:46 | <incertia> | it's so galaxy brained |
| 2020-11-26 08:00:59 | <xerox_> | % :t flip const unsafePerformIO |
| 2020-11-26 08:00:59 | <yahb> | xerox_: forall {c}. c -> c |
| 2020-11-26 08:01:07 | <koz_> | incertia: Type :: Type is the real galaxy brain idea. |
| 2020-11-26 08:01:19 | <dminuoso> | xerox_: Oh I have an idea. |
| 2020-11-26 08:01:24 | <dminuoso> | flip const unsafeCoerce |
| 2020-11-26 08:01:35 | <koz_> | :t flip const unsafeCoerce |
| 2020-11-26 08:01:37 | <lambdabot> | error: Variable not in scope: unsafeCoerce |
| 2020-11-26 08:01:46 | × | acowley quits (~acowley@c-68-83-22-43.hsd1.nj.comcast.net) (Read error: Connection reset by peer) |
| 2020-11-26 08:01:47 | <dminuoso> | % import Unsafe.Coerce |
| 2020-11-26 08:01:47 | <yahb> | dminuoso: |
| 2020-11-26 08:01:52 | <dminuoso> | % :t flip const unsafeCoerce |
| 2020-11-26 08:01:52 | <yahb> | dminuoso: forall {c}. c -> c |
| 2020-11-26 08:01:55 | <dminuoso> | This looks really dangerous. |
| 2020-11-26 08:02:17 | → | Varis joins (~Tadas@unaffiliated/varis) |
| 2020-11-26 08:02:28 | <jle`> | `flip const unsafeCoerce` is pretty much the same as `unsafeCoerce`, ironically |
| 2020-11-26 08:02:33 | <jle`> | just with a more specialized type |
| 2020-11-26 08:02:42 | <dminuoso> | Okay enough of flip const. What other elaborate ways of doing.. nothing can you think of? |
| 2020-11-26 08:02:50 | × | vg quits (~vg@139.59.59.230) (Quit: vg) |
| 2020-11-26 08:03:01 | <jle`> | % map ($ 10) [unsafeCoerce, flip const unsafeCoerce] |
| 2020-11-26 08:03:01 | <koz_> | dminuoso: fmap id |
| 2020-11-26 08:03:01 | <yahb> | jle`: ; <interactive>:92:1: error:; Ambiguous occurrence `map'; It could refer to; either `Data.List.NonEmpty.map', imported from `Data.List.NonEmpty'; or `Prelude.map', imported from `Prelude' (and originally defined in `GHC.Base') |
| 2020-11-26 08:03:06 | → | vg joins (~vg@139.59.59.230) |
| 2020-11-26 08:03:10 | <jle`> | D: |
| 2020-11-26 08:03:15 | <koz_> | dimap id id also works |
| 2020-11-26 08:03:16 | <jle`> | % Prelude.map ($ 10) [unsafeCoerce, flip const unsafeCoerce] |
| 2020-11-26 08:03:17 | <yahb> | jle`: [10,10] |
| 2020-11-26 08:03:28 | × | vg quits (~vg@139.59.59.230) (Remote host closed the connection) |
| 2020-11-26 08:03:28 | <dminuoso> | koz_: well those are very obvious |
| 2020-11-26 08:03:28 | <jle`> | koz_: you mean dimap id id id |
All times are in UTC.