A while ago I decided to learn Haskell to help with learning more "pure functional" ideas that I could apply to F#. Right off the bat it seems as if there's no real types in Haskell like the ones that F# has. I'm fine with that so I wanted to find a way to remove myself from the hybrid OO/Functional design I've used in F# and really try to go classless and truly develop a function centric design. The first thing that came to mind when using Haskell was to just pass tuples around as they can hold information in key value pairs much like dynamic languages but don't have the constructor syntax like F# types.
For example in F#:
type DatabaseWorkValueItem(firstItem, secondItem, thirdItem) =
member public x.FirstItem = firstItem
member public x.SecondItem = secondItem
member public x.ThirdItem = thirdItem
And this would be in my new proposed design:
module DatabaseWorkValueItem =
let firstItem (item, _, _) = item
let secondItem (_,item, _) = item
let thirdItem (_,_, item) = item
--Replace constructor with method
let CreateValueItem (parameter:String, value:Object, sqlType:SqlDbType) =
(parameter, value, sqlType)
--Replace properties with more methods
let GetDataType (item :(String *Object * SqlDbType)) =
thirdItem item
let GetParameter (item :(String *Object * SqlDbType)) =
firstItem item
let GetValue (item :(String *Object * SqlDbType)) =
secondItem item
They both get the same idea. One creates a class like Type with properties set on construction and the other uses all functions to create and read a tuple.
Question is: Am I crazy to bother with this? Although I realize F# has the convenience of jumping between two paradigms, I can't help but feel that it's a comfort blanket to