question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add fmap built-in

See original GitHub issue

fmap would look like:

def fmap(func, obj) =
    obj |> map$(func) |*> obj.__class__

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
evhubcommented, Mar 15, 2017

@Sitwon Yep, that’s exactly it! There was a discussion on Gitter that this stems from about adding more FP-style tools to Coconut. The rationale is that if you added a function like the above, it would make it a lot easier to do this:

>>> data Nothing()
>>> data Just(n)
>>> Just(3) |> map$(-> _*2) |*> Just
Just(n=6)
>>> Nothing() |> map$(-> _*2) |*> Nothing
Nothing()
0reactions
hasufellcommented, Mar 17, 2017

Huh. What package manager are you using? Are you not installing Coconut through pip?

No, I’m using paludis under exherbo. I’ve packaged coconut manually.

Try it now!

Yes, works now!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Built-in Functions — Python 3.11.1 documentation
Create a new dictionary. The dict object is the dictionary class. See dict and Mapping Types — dict for documentation about this class....
Read more >
Add applicative `fmap` and monadic `bind` to Rust's builtin enums
Add applicative `fmap` and monadic `bind` to Rust's builtin enums - monadic_builtins.rs.
Read more >
builtin package
The append built-in function appends elements to the end of a slice. If it has sufficient capacity, the destination is resliced to accommodate...
Read more >
Python map()
In this tutorial, we will learn about the Python map() function with the help of examples. ... In this example, corresponding items of...
Read more >
Built-in Functions
Concatenate a list of lists into a single list. concatMap f list. This function is equivalent to builtins.concatLists (map f list) but is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found