Skip to content

map for non-sequences #169

Open
Open
@ptpaterson

Description

@ptpaterson

Overview

This looks awesome, and makes me want to bring out the whole FP toolkit to use along with ferrum. I'm looking for thoughts and/or best practices for using ferrum with non-sequence objects, too. I.e. more general functors and monads.

Details

The README and project layout make it abundantly clear that the focus is on improve working with iterators. Also, the introduction video makes jokes (which I thoroughly enjoy) when the word "monad" is brought up that no one should have to worry about that means. Still, I am curious what thoughts there are to supporting the more mathematical basis for some of these traits, or at least using this library with other sources that do assume that.

For example, if I start using ferrum, it's only a matter of time before I will want to use some version of type classes for things like Option/Maybe, Either, Result, etc. All of these things should have a map operation. map is hardcoded as applying a function to a sequence, so it cannot be overridden (overloaded? anyway...) with the implementation for non-sequence functors.

I think what I would do is start making a separate local lib with a Functor Trait and define an fmap function for it as the basis for other things.

That said, I think that the Sequence trait could be refactors to be based on a Functor trait. I honestly cannot foresee the fallout of that, but I know it would at least make this library significantly more complex. Not least of all because one can go nuts and add in BiFunctor and Applicative and.... ooh boy then we have all of Haskell now wrapped up in this bloated library... But seriously, I would just as quickly be looking for fmap_left and chain functions as anything else... 🤓 😋

Bonus points for any concrete examples of tying ferrum in with any other fp libraries.

Cheers! And thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions