Zulip Chat Archive

Stream: lean4

Topic: Typeclass outParam vs type member


James Gallicchio (Mar 09 2022 at 20:12):

I am trying to get a version of ToStream with the stream type as a member instead of being a parameter on the class

class Streamable (C : Type u) (τ : outParam (Type v)) where
  toToStream : C  (ρ : Type u) × ToStream C ρ × Stream ρ τ

Is this at all a reasonable approach? Or is there a more canonical way to do this?

Not sure what the tradeoffs are between type members vs outParam type parameters other than universe levels. I read through Baanen's paper but didn't find a relevant design pattern, maybe I missed something.

James Gallicchio (Mar 09 2022 at 20:18):

Also worth noting that the ToStream interface doesn't require that the stream type have a Stream, so I could just drop the dependent product, but my question I guess mostly concerns the tradeoff of outParams


Last updated: Dec 20 2023 at 11:08 UTC