Logs: liberachat/#haskell
| 2021-06-05 13:53:33 | <boxscape> | % instance A Int where test = const () |
| 2021-06-05 13:53:33 | <yahb> | boxscape: |
| 2021-06-05 13:53:35 | <boxscape> | % test 45 |
| 2021-06-05 13:53:35 | <yahb> | boxscape: () |
| 2021-06-05 13:53:37 | <boxscape> | dammit |
| 2021-06-05 13:53:50 | <boxscape> | I must have messed up because I expected to get an ambiguous type variable error |
| 2021-06-05 13:54:06 | <boxscape> | and was going to ask why it doesn't happen with sizeOf 45 |
| 2021-06-05 13:54:15 | → | notzmv joins (~zmv@user/notzmv) |
| 2021-06-05 13:54:52 | × | ddellacosta quits (~ddellacos@86.106.121.235) (Remote host closed the connection) |
| 2021-06-05 13:55:08 | <boxscape> | % class A a where test :: a -> () -- need to redefine the class to get rid of the first instance |
| 2021-06-05 13:55:08 | <yahb> | boxscape: |
| 2021-06-05 13:55:13 | <boxscape> | % instance A Int where test = const () |
| 2021-06-05 13:55:13 | <yahb> | boxscape: |
| 2021-06-05 13:55:16 | <boxscape> | % test 45 |
| 2021-06-05 13:55:16 | <yahb> | boxscape: ; <interactive>:31:1: error:; * Ambiguous type variable `a0' arising from a use of `test'; prevents the constraint `(A a0)' from being solved.; Probable fix: use a type annotation to specify what `a0' should be.; These potential instance exist:; instance [safe] A Int -- Defined at <interactive>:30:10; * In the expression: test 45; In an equation for `it': it = test |
| 2021-06-05 13:55:39 | <boxscape> | % sizeOf 45 -- so, uh, yeah, why don't I get that error message here? |
| 2021-06-05 13:55:39 | <yahb> | boxscape: 8 |
| 2021-06-05 13:56:09 | → | wallymathieu joins (~wallymath@81-234-151-21-no94.tbcn.telia.com) |
| 2021-06-05 13:57:23 | → | zebrag joins (~chris@user/zebrag) |
| 2021-06-05 13:59:06 | × | notzmv quits (~zmv@user/notzmv) (Ping timeout: 264 seconds) |
| 2021-06-05 14:02:27 | → | favonia joins (~favonia@user/favonia) |
| 2021-06-05 14:03:50 | <janus> | maybe it is something lambdabot specific? |
| 2021-06-05 14:04:11 | <boxscape> | janus no, it happens in ghci as well |
| 2021-06-05 14:04:55 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 245 seconds) |
| 2021-06-05 14:06:18 | × | dunkeln quits (~dunkeln@94.129.65.28) (Ping timeout: 264 seconds) |
| 2021-06-05 14:06:36 | → | shapr joins (~user@pool-100-36-247-68.washdc.fios.verizon.net) |
| 2021-06-05 14:09:38 | <ski> | % test (45 :: Int) |
| 2021-06-05 14:09:38 | <yahb> | ski: () |
| 2021-06-05 14:09:44 | → | eight joins (~eight@user/eight) |
| 2021-06-05 14:10:32 | <ski> | % instance A Integer where test !_ = () |
| 2021-06-05 14:10:32 | <yahb> | ski: |
| 2021-06-05 14:10:40 | × | pe200012 quits (~pe200012@58.248.179.167) (Remote host closed the connection) |
| 2021-06-05 14:10:46 | <ski> | % test (undefined :: Int) |
| 2021-06-05 14:10:46 | <yahb> | ski: () |
| 2021-06-05 14:10:51 | <ski> | % test (undefined :: Integer) |
| 2021-06-05 14:10:51 | <yahb> | ski: *** Exception: Prelude.undefined; CallStack (from HasCallStack):; error, called at libraries/base/GHC/Err.hs:75:14 in base:GHC.Err; undefined, called at <interactive>:37:7 in interactive:Ghci33 |
| 2021-06-05 14:11:07 | <boxscape> | % test 45 |
| 2021-06-05 14:11:07 | <yahb> | boxscape: () |
| 2021-06-05 14:11:18 | → | pe200012 joins (~pe200012@120.236.162.25) |
| 2021-06-05 14:11:27 | <ski> | well, in this case, i suppose it defaults to `Integer' |
| 2021-06-05 14:11:36 | <boxscape> | yeah |
| 2021-06-05 14:12:16 | <ski> | % class A a where {test :: a -> ()}; instance A Int where {test = const ()}; instance A Bool where {test !_ = ()} |
| 2021-06-05 14:12:17 | <yahb> | ski: |
| 2021-06-05 14:12:22 | <ski> | % test 45 |
| 2021-06-05 14:12:22 | <yahb> | ski: ; <interactive>:40:1: error:; * Ambiguous type variable `a0' arising from a use of `test'; prevents the constraint `(A a0)' from being solved.; Probable fix: use a type annotation to specify what `a0' should be.; These potential instances exist:; instance [safe] A Bool -- Defined at <interactive>:39:85; instance [safe] A Int -- Defined at <interactive>:39:45; * In |
| 2021-06-05 14:12:50 | × | neceve quits (~quassel@2a02:c7f:607e:d600:a95a:ecd2:e57a:3130) (Ping timeout: 244 seconds) |
| 2021-06-05 14:13:07 | <ski> | satisfied ? |
| 2021-06-05 14:13:36 | <boxscape> | ski erm, I'm still not sure why I don't get that error message with sizeOf |
| 2021-06-05 14:13:47 | <boxscape> | % sizeOf (45 :: Integer) |
| 2021-06-05 14:13:47 | <yahb> | boxscape: ; <interactive>:41:1: error:; * No instance for (Storable Integer) arising from a use of `sizeOf'; * In the expression: sizeOf (45 :: Integer); In an equation for `it': it = sizeOf (45 :: Integer) |
| 2021-06-05 14:13:57 | <boxscape> | it's not defaulting to Integer, in that case, so.. |
| 2021-06-05 14:14:16 | → | grepcake joins (~artyom@77.234.209.96) |
| 2021-06-05 14:14:24 | <geekosaur> | defaulting to Double? |
| 2021-06-05 14:15:00 | <janus> | % sizeOf (45 :: _) |
| 2021-06-05 14:15:00 | <yahb> | janus: ; <interactive>:42:15: error:; * Found type wildcard `_' standing for `Double'; To use the inferred type, enable PartialTypeSignatures; * In an expression type signature: _; In the first argument of `sizeOf', namely `(45 :: _)'; In the expression: sizeOf (45 :: _); * Relevant bindings include it :: Int (bound at <interactive>:42:1) |
| 2021-06-05 14:15:08 | <geekosaur> | and ExtendedDefaultRules so it applies this to Storable instead of just the builtin ones |
| 2021-06-05 14:15:08 | <boxscape> | ahh, okay |
| 2021-06-05 14:15:22 | → | dunkeln joins (~dunkeln@94.129.65.28) |
| 2021-06-05 14:15:23 | <geekosaur> | (iirc) |
| 2021-06-05 14:15:38 | <boxscape> | % :set -XNoExtendedDefaultRules |
| 2021-06-05 14:15:38 | <yahb> | boxscape: |
| 2021-06-05 14:15:45 | <boxscape> | % sizeOf (45 :: _) |
| 2021-06-05 14:15:45 | <yahb> | boxscape: ; <interactive>:45:1: error:; * Ambiguous type variable `a0' arising from a use of `sizeOf'; prevents the constraint `(Storable a0)' from being solved.; Probable fix: use a type annotation to specify what `a0' should be.; These potential instances exist:; instance Storable a => Storable (Complex a) -- Defined in `Data.Complex'; instance forall a k (b :: k). Storable |
| 2021-06-05 14:15:53 | <boxscape> | yep, thanks geekosaur |
| 2021-06-05 14:17:36 | × | grepcake quits (~artyom@77.234.209.96) (Client Quit) |
| 2021-06-05 14:17:43 | → | safinaskar joins (~user@109.252.90.89) |
| 2021-06-05 14:17:58 | <safinaskar> | is there some guide "how to design good haskell APIs"? |
| 2021-06-05 14:18:49 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-06-05 14:19:48 | × | Natch quits (~natch@c-e070e255.014-297-73746f25.bbcust.telenor.se) (Remote host closed the connection) |
| 2021-06-05 14:20:28 | <janus> | % default (Int) |
| 2021-06-05 14:20:28 | <yahb> | janus: |
| 2021-06-05 14:20:31 | → | finn_elija joins (~finn_elij@user/finn-elija/x-0085643) |
| 2021-06-05 14:20:32 | FinnElija | is now known as Guest2629 |
| 2021-06-05 14:20:32 | finn_elija | is now known as FinnElija |
| 2021-06-05 14:20:33 | <janus> | % sizeOf (45 :: _) |
| 2021-06-05 14:20:33 | <yahb> | janus: ; <interactive>:48:1: error:; * Ambiguous type variable `a0' arising from a use of `sizeOf'; prevents the constraint `(Storable a0)' from being solved.; Probable fix: use a type annotation to specify what `a0' should be.; These potential instances exist:; instance Storable a => Storable (Complex a) -- Defined in `Data.Complex'; instance forall a k (b :: k). Storable |
| 2021-06-05 14:20:56 | <janus> | % :set -XExtendedDefaultRules |
| 2021-06-05 14:20:56 | <yahb> | janus: |
| 2021-06-05 14:20:59 | <janus> | % sizeOf (45 :: _) |
| 2021-06-05 14:20:59 | <yahb> | janus: ; <interactive>:50:15: error:; * Found type wildcard `_' standing for `Int'; To use the inferred type, enable PartialTypeSignatures; * In an expression type signature: _; In the first argument of `sizeOf', namely `(45 :: _)'; In the expression: sizeOf (45 :: _); * Relevant bindings include it :: Int (bound at <interactive>:50:1) |
| 2021-06-05 14:21:14 | <janus> | oooh i did not know this default syntax :O |
| 2021-06-05 14:21:14 | → | grepcake joins (~artyom@77.234.209.96) |
| 2021-06-05 14:21:35 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-06-05 14:21:47 | × | favonia quits (~favonia@user/favonia) (Ping timeout: 252 seconds) |
| 2021-06-05 14:22:11 | <janus> | safinaskar: i think Graninas has written a book that claims to answer this question. But there are varied opinions about it ;) |
| 2021-06-05 14:22:39 | <janus> | % default _ |
| 2021-06-05 14:22:39 | <yahb> | janus: ; <interactive>:51:9: error: parse error on input `_' |
| 2021-06-05 14:23:03 | <boxscape> | huh why does the _ in sizeOf (45 :: _) now stand for Int when it stood for double a few lines before that |
| 2021-06-05 14:23:15 | <boxscape> | oh |
| 2021-06-05 14:23:20 | <boxscape> | because you typed default (Int) |
| 2021-06-05 14:23:27 | <janus> | right, i am a hax0r |
| 2021-06-05 14:23:31 | <boxscape> | :) |
| 2021-06-05 14:23:54 | → | favonia joins (~favonia@user/favonia) |
| 2021-06-05 14:24:01 | → | eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:a54f:2e66:1417:26d8) |
| 2021-06-05 14:25:11 | <safinaskar> | janus: thanks |
| 2021-06-05 14:25:45 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 244 seconds) |
| 2021-06-05 14:28:20 | × | eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:a54f:2e66:1417:26d8) (Ping timeout: 244 seconds) |
| 2021-06-05 14:28:26 | → | renzhi joins (~xp@2607:fa49:6500:bc00::e7b) |
| 2021-06-05 14:28:44 | → | Natch joins (~natch@c-e070e255.014-297-73746f25.bbcust.telenor.se) |
| 2021-06-05 14:31:26 | × | favonia quits (~favonia@user/favonia) (Ping timeout: 244 seconds) |
All times are in UTC.