typelift / Swiftz

Functional programming in Swift
BSD 3-Clause "New" or "Revised" License
3.33k stars 233 forks source link

Algebraic data types #276

Closed mpurland closed 8 years ago

mpurland commented 9 years ago

I was working on algebraic data types and looked at NumericType. Any thoughts about the following?

Commit: df501564ebb69b5095f1f09ed1557f11dc924ce6

CodaFi commented 9 years ago

I don't know what we gain by each unless you intend to rename Addable and Multipliable to some Semigroup puns, Subtractable as the mate of Semigroup and Invertable and move Signum somewhere else entirely. Basically, I think Haskell's authors, when they were writing Num, just shot for the minimum viable structure they could start defining easy arithmetic operations on.

For what it's worth, this would go great in the Algebra package, though.

mpurland commented 8 years ago

Should I move this over to Algebra?

CodaFi commented 8 years ago

Yeah. First I have to see if that thing doesn't crash Swiftc and merge that leftover PR. Could you open the build script pull request over there too while you're at it?

mpurland commented 8 years ago

How I long for the days that Swiftc doesn't crash...

Will do. I'll update the remaining projects with the build scripts this evening.