[Haskell-cafe] Need ideas how to model the lack of something

Carlo Hamalainen carlo at carlo-hamalainen.net
Tue Dec 15 08:02:05 UTC 2015

On 15/12/2015 15:33, Joachim Durchholz wrote:
> I see Kim-Ee Yeoh stating that Martin is stuck without a way forward
> due to using OO style, which seems more serious than just "wordy and
> unnatural".
> Or am I misreading his words, and that "OO-style" reference was just
> descriptive rather than presenting the base cause of Martin's problems?

The OP originally wrote an insert function with this type:

insert :: a -> Maybe (C a)

which sort of looks like an insert function from an OO language where
the self object is implicit. In functional style it should be

insert :: a -> C a -> Maybe (C a)

Another way: it's impossible to implement

insert :: a -> Maybe (C a)
insert a = ???

because there is no 'C a' to modify.

Carlo Hamalainen

More information about the Haskell-Cafe mailing list