3 ms·
My google-fu is not turning up any definition of `row type'. Are we talking record types here? Probably not because doesn't Haskell have a record type (much mal
by igravious 10y ago
My google-fu is not turning up any definition of `row type'. Are we talking record types here? Probably not because doesn't Haskell have a record type (much maligned though it is).
- tome 10y agoYes, "record type" is probably better way of describing it. I think "row type" might be used when using record types in the context of database tables.
- catnaroek 10y agoYou can think of structural record types as being formed by applying a special type constructor to a type-level collection of types: row Fields = [name: String, age: Int] type Person = MkRecord Fields Which have kinds: MkRecord :: Row Type -> Type Fields :: Row Type Person :: Type You can construct variant types in a similar way: row Cases = [success: SyntaxTree, failure: ParseError] type ParseResult = MkVariant Cases Which have kinds: MkVariant :: Row Type -> Type Cases :: Row Type ParseResult :: Type Rows may contain things other than proper types, for example: row Effects = [foo: State s, bar: Except e] type Action = MkFunction Effects Which have kind: -- function types now take three arguments: -- - row of effects -- - argument type -- - return type MkFunction :: Row Effect -> Type -> Type -> Type Effects :: Row Effect Action :: Type -> Type -> Type
- igravious 10y agoI'm going to go with: row = sequence record = named conjunctive sequence variant = named disjunctive sequence :) Can you explain what you mean when you say "proper" types? (So I can get what you mean from there on out.) Are all your examples using regular standard Haskell syntax? (I get that you are making up type (and kind) names for illustration purposes). Thanks!