Logs: freenode/#haskell
| 2020-11-16 06:33:49 | <moet> | instance Num 'A where ... fails because `'A :: T` but `Num :: * -> Constraint` |
| 2020-11-16 06:34:04 | × | towel quits (~towel@unaffiliated/towel) (Quit: ZNC - https://znc.in) |
| 2020-11-16 06:34:05 | × | {abby} quits (~{abby}@unaffiliated/demhydraz) (Quit: Ping timeout (120 seconds)) |
| 2020-11-16 06:34:11 | → | {abby}2 joins (~{abby}@unaffiliated/demhydraz) |
| 2020-11-16 06:34:38 | × | guest1116 quits (~user@49.5.6.87) (Ping timeout: 265 seconds) |
| 2020-11-16 06:35:02 | → | towel joins (~towel@unaffiliated/towel) |
| 2020-11-16 06:35:07 | × | pavonia quits (~user@unaffiliated/siracusa) (Ping timeout: 260 seconds) |
| 2020-11-16 06:35:09 | pavonia_ | is now known as pavonia |
| 2020-11-16 06:38:47 | <moet> | nevermind.. the problem was a stuck type family upstream .. |
| 2020-11-16 06:39:43 | → | coot_ joins (~coot@37.30.49.253.nat.umts.dynamic.t-mobile.pl) |
| 2020-11-16 06:40:43 | × | coot quits (~coot@37.30.49.253.nat.umts.dynamic.t-mobile.pl) (Ping timeout: 256 seconds) |
| 2020-11-16 06:40:44 | coot_ | is now known as coot |
| 2020-11-16 06:41:12 | × | Sanchayan quits (~Sanchayan@171.61.102.109) (Quit: leaving) |
| 2020-11-16 06:41:26 | <moet> | now i have questions about stuck type families if anybody has their polykinds hat on |
| 2020-11-16 06:41:32 | → | quarters joins (~quarters@unaffiliated/quarters) |
| 2020-11-16 06:41:40 | <moet> | otherwise i'll just figure it out |
| 2020-11-16 06:43:05 | <quarters> | hello. I'm following http://learnyouahaskell.com/syntax-in-functions and noticed that type declarations are shown above every function. Is this something that can be replicated in the ghci repl? when I try it, I get <interactive>:18:1: error: |
| 2020-11-16 06:43:05 | <quarters> | • No instance for (Show (Integer -> String)) |
| 2020-11-16 06:43:05 | <quarters> | arising from a use of ‘print’ |
| 2020-11-16 06:43:05 | <quarters> | (maybe you haven't applied a function to enough arguments?) |
| 2020-11-16 06:43:06 | <quarters> | • In a stmt of an interactive GHCi command: print it |
| 2020-11-16 06:43:30 | → | o1lo01ol1o joins (~o1lo01ol1@bl11-140-216.dsl.telepac.pt) |
| 2020-11-16 06:43:30 | × | matthew- quits (~matthew@smtp.wellquite.org) (Ping timeout: 272 seconds) |
| 2020-11-16 06:43:50 | → | matthew- joins (~matthew@smtp.wellquite.org) |
| 2020-11-16 06:47:12 | <moet> | quarters: yes, there are two ways https://termbin.com/zngt |
| 2020-11-16 06:47:47 | <moet> | quarters: one is to type a one-liner lambda on the rhs of a let, parenthesize the whole lambda, and then give it a type |
| 2020-11-16 06:47:52 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 256 seconds) |
| 2020-11-16 06:48:05 | × | o1lo01ol1o quits (~o1lo01ol1@bl11-140-216.dsl.telepac.pt) (Ping timeout: 256 seconds) |
| 2020-11-16 06:48:14 | <moet> | quarters: the other is to write a multi-line-function just as you would in a file, by preceding it with :{ and then following it with :} |
| 2020-11-16 06:48:24 | <moet> | see the paste at https://termbin.com/zngt |
| 2020-11-16 06:48:37 | → | Sanchayan joins (~Sanchayan@171.61.102.109) |
| 2020-11-16 06:49:34 | <quarters> | moet: awesome. thank you! |
| 2020-11-16 06:50:01 | × | falafel_ quits (~falafel@50.216.77.242) (Ping timeout: 264 seconds) |
| 2020-11-16 06:52:58 | <moet> | does making a type-family have a result of kind `k` automatically make the type family "stuck"? is there a way to inspect the result? |
| 2020-11-16 06:55:03 | <Axman6> | :kind! should show you it in as evaluated for as possible |
| 2020-11-16 06:55:19 | → | justanotheruser joins (~justanoth@unaffiliated/justanotheruser) |
| 2020-11-16 06:55:32 | <Axman6> | (that's probably not a precide definition of what it does, but :kind! is probably what you're after) |
| 2020-11-16 06:56:02 | → | avn joins (~avn@78-56-108-78.static.zebra.lt) |
| 2020-11-16 06:56:22 | → | santa_1 joins (~santa_@185.163.110.116) |
| 2020-11-16 06:58:19 | <moet> | Axman6: hrm.. that tool does help me to identify the problem but my question is more about what the meaning of a polymorphic typeclass is |
| 2020-11-16 06:58:37 | <moet> | Axman6: if you have a sec, take a look at this minimal example: https://termbin.com/n79h |
| 2020-11-16 06:59:13 | <moet> | in the example, i've made a type family that seems to be useless, because it is stuck due to its polymorphic result |
| 2020-11-16 07:00:48 | <dminuoso> | moet: No, typeclasses can have instances for non-* types as well. See Functor |
| 2020-11-16 07:01:12 | <dminuoso> | Oh, scrolled up again. |
| 2020-11-16 07:01:52 | <Axman6> | this is definitely beyond my knowledge of these things |
| 2020-11-16 07:02:07 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Quit: leaving) |
| 2020-11-16 07:02:51 | <moet> | dminuoso: heh, yeah, i realized the issue with that typeclass was actually the stuck type family not resolving to the type which matched the typeclass :) |
| 2020-11-16 07:03:09 | <moet> | Axman6: thanks for taking a look anyhow.. it's beyond my knowledge too! |
| 2020-11-16 07:03:17 | <dminuoso> | Im surprised this typechecks at all |
| 2020-11-16 07:03:37 | <dminuoso> | Or kindchecks, rather |
| 2020-11-16 07:04:10 | <moet> | dminuoso: it does admittedly require like 4 extensions |
| 2020-11-16 07:04:27 | <keltono> | try `:t funcName` |
| 2020-11-16 07:04:35 | <keltono> | whoops, wrong channel |
| 2020-11-16 07:04:41 | <dminuoso> | moet: which ones? |
| 2020-11-16 07:04:48 | <dminuoso> | TypeFamilies and PolyKinds presumably |
| 2020-11-16 07:04:50 | <dminuoso> | Which else? |
| 2020-11-16 07:04:56 | <moet> | DataKinds and KindSignatures |
| 2020-11-16 07:05:08 | <dminuoso> | Ah, well those make sense too |
| 2020-11-16 07:05:12 | <moet> | Though DataKinds is probably only because i used tuple on RHS |
| 2020-11-16 07:05:15 | <dminuoso> | Right |
| 2020-11-16 07:05:25 | <dminuoso> | You could alternatively say |
| 2020-11-16 07:05:32 | <dminuoso> | % type family TF (a :: *) :: k |
| 2020-11-16 07:05:32 | <yahb> | dminuoso: |
| 2020-11-16 07:05:40 | <dminuoso> | % type instance TF Bool = Type |
| 2020-11-16 07:05:40 | <yahb> | dminuoso: ; <interactive>:102:25: error:; Ambiguous occurrence `Type'; It could refer to; either `Language.Haskell.TH.Type', imported from `Language.Haskell.TH' (and originally defined in `Language.Haskell.TH.Syntax'); or `Data.Kind.Type', imported from `Data.Kind' (and originally defined in `GHC.Types') |
| 2020-11-16 07:05:57 | <dminuoso> | % type instance TF Bool = Data.Kind.Type |
| 2020-11-16 07:05:57 | <yahb> | dminuoso: |
| 2020-11-16 07:06:02 | <dminuoso> | % type instance TF Int = Data.Kind.Type -> Data.Kind.Type |
| 2020-11-16 07:06:03 | <yahb> | dminuoso: |
| 2020-11-16 07:07:42 | <moet> | % :kind! TF Bool |
| 2020-11-16 07:07:43 | <yahb> | moet: k; = TF Bool |
| 2020-11-16 07:07:47 | <moet> | % :kind! TF Int |
| 2020-11-16 07:07:47 | <yahb> | moet: k; = TF Int |
| 2020-11-16 07:07:52 | <moet> | also stuck? |
| 2020-11-16 07:08:06 | <dminuoso> | I dont think "stuck" is the right terminology here |
| 2020-11-16 07:08:19 | <dminuoso> | % :kind! TF Int |
| 2020-11-16 07:08:19 | <yahb> | dminuoso: forall {k}. k; = TF Int |
| 2020-11-16 07:08:33 | <dminuoso> | (I added :set -fprint-explicit-foralls in a query) |
| 2020-11-16 07:08:46 | <dminuoso> | So it returns a polymorphic kind |
| 2020-11-16 07:08:58 | <moet> | yes, i think it's because k cannot be both * and (* -> *) at the sametime |
| 2020-11-16 07:09:04 | <dminuoso> | The confusing thing is why the tf instances type check at all, because `Type` is certainly *not* polymorphic |
| 2020-11-16 07:09:46 | <dminuoso> | But then again, I only know how you can have polymorphic kinds in negative positions (say like Const) |
| 2020-11-16 07:09:54 | <dminuoso> | Or *polymorphic types rather |
| 2020-11-16 07:10:18 | <dminuoso> | Let's say we did |
| 2020-11-16 07:10:29 | <dminuoso> | % data C (forall k. t :: k) = C |
| 2020-11-16 07:10:30 | <yahb> | dminuoso: ; <interactive>:111:9: error:; Unexpected type `forall k. t :: k'; In the data declaration for `C'; A data declaration should have form; data C a = ... |
| 2020-11-16 07:11:02 | <dminuoso> | Oh that's not allowed? |
| 2020-11-16 07:11:37 | <glguy> | % :kind! TF Bool :: * |
| 2020-11-16 07:11:37 | <yahb> | glguy: *; = * |
| 2020-11-16 07:11:48 | <glguy> | % :kind! [TF Bool] |
| 2020-11-16 07:11:48 | <yahb> | glguy: *; = [*] |
| 2020-11-16 07:12:11 | <moet> | % :kind! [TF Int] |
| 2020-11-16 07:12:11 | <yahb> | moet: *; = [* -> *] |
| 2020-11-16 07:12:15 | <moet> | oh, wow.. |
| 2020-11-16 07:12:17 | <dminuoso> | Is it possible this tyfam crosses universes and returns a proper kind? |
| 2020-11-16 07:12:29 | <dminuoso> | (Sort of TypeInType) |
| 2020-11-16 07:12:50 | <dminuoso> | No this is still weird |
| 2020-11-16 07:12:51 | <glguy> | You have to know the desired result kind to know which TF instance to use |
| 2020-11-16 07:13:14 | <glguy> | % type instance TF Bool = (->) |
| 2020-11-16 07:13:14 | <yahb> | glguy: |
All times are in UTC.