On 4 April 2015 at 10:47, Matt Oliveri <[email protected]> wrote: > On Sat, Apr 4, 2015 at 4:37 AM, Keean Schupke <[email protected]> wrote: > > A further thought on type-level-Booleans for function arrows. I like the > > principle of using enumerations with specific names to avoid domain > > problems. Really classifying a 'call' as a true boolean allows it to be > > compared and assigned to other Booleans which are from a different > domain. > > Technically, there's no domain problem. A Bool is a Bool, no matter > what meaning we attach to its elements in a particular context. > Special-purpose names are clearer though, since so far, it's all we're > using Bools for. >
The domain problem occurs like this: we have a kind for "is a hare" and a kind for "is a rabbit". If we have Hare as a variable of kind "is a hare" and Rabbit of kind "is a rabbit", then: Hare := Rabbit is not allowed (quite correctly as this would create a logical error). If both Hare and Rabbit share the same Boolean kind, then we can do such illogical things. Really "Boolean" should only be allowed for the results of comparison operators like "=", "/=", ">" etc... Most other things should be encoded as unique enums like: data IsHare = Hare | NotHare data IsRabbit = Rabbit | NotRabbit Keean.
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
