Unify monadic and pure implementation
- Vorherrschende Sprache
- Haskell
- Sterne
- 98
- Forks
- 17
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
The pure implementation should be a specialized version of the monadic code to Identity. Goal: remove code duplication
However, the resulting Core for pure and monadic Identity should be really quite similar to ensure performance doesn't regress in the pure case.
Unfortunately, when I tried to do this last I found the generated code for the monadic code specialized at Identity was wildly different from the pure version.
Notably, `>>=` and friends weren't being inlined. This is critical!
It turns out Identity's Functor, Applicative, Monad instances don't have `INLINE` pragmas (awful!)
I intend to open a CLC proposal to add INLINE pragmas to Identity's instances, pointing to here as a real world example where it was found that the definition wasn't enough.
However, `hegg` will likely still want a solution which doesn't regress performance for older base versions. I'm thinking we could define our own `Identity` type with INLINE pragmas.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.