Giter Site home page Giter Site logo

artyom.me's People

Contributors

zoren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

rs-store

artyom.me's Issues

Type signature of `iterated` is incorrect in lens over tea #3

You have

iterated :: Fold1 a a
iterated f g a = go a
  where go a = g a .> go (f a)

but I think it should be

iterated :: (a -> a) -> Fold1 a a
iterated f g a = go a
  where go a = g a .> go (f a)

The signatures in the open question below agree with this.

All the best,
Richard

Aeson tutorial: improve description of `.:?`

Currently it reads:

.:? is just like .:, but doesn't fail if the field wasn't found (it does fail if the field was found but has a different type, however).

That description actually matches the .:! operator, not .:?.

.:! doesn't fail if the field wasn't found.

.:? doesn't fail if the field wasn't found or if its value is Null.

See the docs for .:?.

This shouldn't usually come up, it can't hurt to be precise. I'm really enjoying the tutorial so far btw!

Possibly use jle's thing in lens over tea

02:08 <magbo> (<%~) l h y = l (\x -> (h x, h x)) y 
02:08 <magbo> Works on every lens.
02:08 <magbo> Returns (b, t) -- updated focused value and updated source
02:09 <puregreen> magbo: do you know how the Functor instance for (,) works?
02:09 <magbo> (,) is the outer functor, that was my intention when I was writing it
02:10 <magbo> puregreen: oh snap, it answers my question!
02:10 <jle`> it's Writer! :O
02:11 <jle`> magbo: `(\x -> tell (h x) >> return (h x))` would get you 
             the Writer translation of what you wrote
02:11 <puregreen> jle`: ooh, I like this one
02:12 <puregreen> gotta steal it for lens over tea
02:12 <jle`> it's technically wrong because it requires a Monoid instance i think
02:16 <jle`> puregreen: oh, you can get a working version of what i wrote
             with tell (h x) $> h x, because while it's equivalent to 
             tell (h x) *> return (h x), it doesn't require a Monoid constraint

Isomorphism explanation, enum confusion

Hello,
First of all, thanks for the great series :)

I'm trying to understand the note about enum in lens over tea 4. Specifically, this part:

Now let's consider 2 cases – the first is when we use it to turn s into a, the second is when we use the iso to turn b into t. The definition we already have works well enough for the former case, but in the latter case s doesn't even exist:

enum f = \_ -> fromEnum <$> f ???

I don't understand what you mean by saying "turn the b into the t".

From what I understand,

enum :: Lens' Int a
enum :: Lens Int Int a a ~= Lens s t a b
b -> t :: a -> Int

why is this not a valid candidate?

enum_rev :: Lens' a Int
enum_rev f a = toEnum <$> f (fromEnum a)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.