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.

I often write several levels of map: map (map (...

Is it possible to implement a generic “deepMap” that maps the innermost or arbitrarily nested functors?

Possible inspiration: http://okmij.org/ftp/Haskell/typecast.html#deepest-functor

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

3reactions
adzcommented, Jan 23, 2020

You are dealing with two monads - async and result… So monad transformers are just a type to help combine them.

I have ResultT<Async<Result<_>>> because I am combining with Async. It seems a bit backwards as the Result is inner. The ResultT can combine with any other monad.

I wrote notes as I started to feel comfortable with them, because I also struggled to comprehend them for a long time… See here http://adzdavies.blogspot.com/2019/12/monadtransformers-lets-look-at-resultt.html

2reactions
gustycommented, Dec 18, 2019

There is Compose which allows you to compose arbitrary functors

https://github.com/fsprojects/FSharpPlus/blob/33fa3411cb080fc70d8b4ad4f71e16d63bc82128/src/FSharpPlus/Monoids.fs#L93-L114

But what you want is to avoid wrapping / unwrapping.

We could add a set of map2 mapN functions, additionally/alternatively we could add some funny versions of applicative operators like <!!> and <**>.

Definitely it’s something to consider.

A full generic deepmap over an arbitrary number of functors is quite complex to encode, it might be possible I have to give it a try.

Then if it works we have to see how is type inference, my feeling is that with the current state of the F# compiler it won’t be amazing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deep map - Wikipedia
A deep map is a map with greater information than a two-dimensional image of places, names, and topography. One such kind of intensive...
Read more >
Deep Maps and Spatial Narratives
Deep maps are finely detailed, multimedia depictions of a place and the people, buildings, objects, flora, and fauna that exist within it and...
Read more >
The Deep Map The Philos Project
The Deep Map is a weekly podcast that explores the hidden religious and cultural forces driving headlines in the Near East and around...
Read more >
DeepStateMAP | Map of the war in Ukraine
News of Russia's war against Ukraine on the map. ... It's dangerous and forbidden to use this map for green corridors – it...
Read more >
Defining Deep Maps - The Polis Center - IUPUI
Don: Deep mapping is an epistemology for studying spatial patterns, processes, or phenomena through the integration of a wide-range of spatially and temporally ......
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