stevenfontanella / microlens Goto Github PK
View Code? Open in Web Editor NEWA lightweight (but compatible with ‘lens’) lenses library
Home Page: https://hackage.haskell.org/package/microlens
A lightweight (but compatible with ‘lens’) lenses library
Home Page: https://hackage.haskell.org/package/microlens
The >>> blah
ones.
[here was a list of things, but it's no more]
And that it lets you replace failing
in many cases, too. And also that you can do stuff like ([],2,3) ^? (_1.each <> _2 <> _3)
.
> set both 0 undefined
(0,0)
(It was already there, but then I deleted it. I guess I shouldn't have.)
With runnable code and stuff.
(<$) = set mapped
...and warn in Lens.Micro.Internal
about perils of orphan instances (in particular, Ixed
, At
, and Each
shouldn't be used for anything apart from providing additional instances, and it's especially forbidden to export functions with Ixed a =>
/etc in the signature).
And write in readme that this way orphan instances aren't that scary anymore.
And remove the “there's no to
” bit in the readme.
Some of the package links point to hackage.haskell.com
instead of hackage.haskell.org
. haskell.com
apparently exists but doesn't have to do anything with Haskell the programming language, and it doesn't have a hackage.
subdomain.
ageAndCity :: Person :-> (Int, String)
ageAndCity = point $
(,) <$> fstL >- age
<*> sndL >- city . place
This example should be replicated in docs.
Should be easy enough. (If anyone wants to do it instead of me, ne's welcome!)
https://www.reddit.com/r/haskell/comments/3g22sb/microlens_a_small_lenses_library_with_no/ctuidjx
Look at the type of
Lens s t a b = (a -> f b) -> s -> f t
pick
f = (,) a
to get(a -> (a, b)) -> s -> (a, t)
and this lets you give back the 'old' value_2 (\a -> (a, "new value")) (1,2)
If we instead pick
f = (,) b
(a -> (b, b)) -> s -> (b, t)
this lets you give back the 'new' value with something like
_2 (\a -> join (,) (a + 1))
Apparently I can find out which modules are marked as unsafe by doing
cabal build --ghc-options "-fwarn-unsafe -fwarn-safe"
https://en.wikibooks.org/wiki/Haskell/Lenses_and_functional_references
Gotta link to it somewhere.
over (ix 1 . ix 1) (+1) [[2,0,0,2],[0,0,0,0],[0,0,0,0],[2,0,0,2]]
gives back th expected result.
But in the absence of preview
how does one retrieve the element?
Perhaps this could be the first step towards Lens.Micro
being an adequate lens tutorial.
Additionally, since all these are in the Platform, there could be a package called “microlens-platform” uniting them.
Should add: taking
, dropping
, element
, elementOf
.
Done with: failing
, filtered
, singular
.
Write docs for it, and move the conditional import to the beginning.
And check whether it actually is promised in README.
(and add a "please read this tutorial [somewhere else] so that you'd be able to do the Ctrl-Enter thing" warning in bold somewhere on the top)
This would let us not have boring stuff in the docs.
microlens-th doesn't compile with ghc-7.11 as that ships with template-haskell 2.11.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.