4 ms·
Why Koka? This is not snark. Why Koka when ML and Haskell exist? What does it bring to the table that is new? What Haskell calls monads Koka calls effects? But
by igravious 10y ago
Why Koka?
This is not snark. Why Koka when ML and Haskell exist? What does it bring to the table that is new? What Haskell calls monads Koka calls effects? But Haskell has lazy evaluation, right -- and Koka is strict (like ML) and tracks effects (like Haskell). Does Koka complete this reductive functional programming matrix?
/ Monads / No monads†
-----------------------
S | Koka | ML
L | Haskell | Miranda
† No monads == Nomads?
- catnaroek 10y agoIn a lazy language like Haskell, you often define pure functions whose result is an effectful monadic action. In a strict language, it makes more sense to qualify functions themselves as being pure or effectful. So you end up working with Kleisli arrows, which are still related to monads. Also, the way Haskell handles composing effects (monad transformers), while precise, sometimes leaves a lot to be desired in terms of usability. That's why other approaches to managing effectful computations are being explored, like algebraic effects.
- tome 10y agoKoka tags effects using something like row types. This may very well be easier to use. There's no reason Haskell couldn't do this if it had row types, but it doesn't, so it doesn't.
- igravious 10y agoMy 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!