Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 19:28

    SethTisue on 2.13.x

    2.12: new Scala SHA 2.12: update expected-failure l… add akka-http-webgoat (#1017) and 1 more (compare)

  • 19:08

    SethTisue on 2.11.x

    sbt version bump (1.3.3->1.3.4)… 2.12: new Scala SHA 2.12: update expected-failure l… and 3 more (compare)

  • 19:04
    SethTisue commented #8545
  • 19:03
    som-snytt commented #11824
  • 18:54
    som-snytt labeled #11824
  • 18:54
    som-snytt commented #11824
  • 18:46
    som-snytt review_requested #8591
  • 18:46
    scala-jenkins milestoned #8591
  • 18:46
    som-snytt opened #8591
  • 18:38
    SethTisue milestoned #3237
  • 18:38
    SethTisue assigned #9386
  • 18:38
    SethTisue milestoned #9386
  • 15:21
    som-snytt commented #8590
  • 14:50
    lrytz commented #8588
  • 13:12

    lrytz on 2.13.x

    Avoid length of list Lint confusing by-name conversi… Lint by-name conversion of bloc… and 1 more (compare)

  • 13:12
    lrytz closed #8590
  • 13:12
    lrytz closed #9386
  • 13:12
    lrytz closed #3237
  • 09:36
    dwijnand commented #1016
  • 09:32
    dwijnand commented #1008
Fabio Labella
@SystemFw
basically used to refer to an F[_]

I would not consider Option/Either an effect. Sometimes Either is used where non-FP people would throw an exception (which would be an effect), but that's the closest connection I can see. At the moment, I have a hard time to define 'effect', but I'd describe it as changes that were not part of your functions' arguments or return values, such as the contents of the stdin buffer, some observable memory location, or the continuation of the function call.

you are talking about side-effects here, which has a precise definition: something that breaks referential transparency

Martijn Hoekstra
@martijnhoekstra
I think (but I'm not sure) Effect[F[_]] in cats effect could have the more precise (but less convenient) name SideEffectSuspensionStrategyProvider
as soon as you name it that though, you really need to make a SideEffectSuspensStrategyProviderFactoryBeanjust as a sort of Pavlov reaction
(queue vehement disagreement from Fabio)
Fabio Labella
@SystemFw
:P
lysium
@lysium
@SystemFw Thank you for clarifying! You're completely right!
@ochrons Thank you for the video! I love the phrase "F[A]: This is a program in F that computes a value of type A." I think it accurately describes what we think of F[A]: we are actually interested in computing A, but we use the stuff fromF to do that. Now I think I better understand the phrase "F[A] is an effect on A".
Martijn Hoekstra
@martijnhoekstra
Of course, "a program in F" is still a bit wishy-washy
at some point, you run out of analogies though, and things are just what they are
dadepo
@dadepo

The word "effect" has always confused me in any description of FP, I only have a kind of mental model of the type of thing that might be going on when someone says effect, it definitely makes any sentence in it less informative to me :) But that's probably just me

@trepidacious Nope...that makes us two...plenty sure many more like us out there :D

effect does not, it's just a convenient term basically used to refer to an F[_]

@SystemFw I have seen context, or computational context used to describe this...will I be right to say that effect is just another way of saying the same thing?

Fabio Labella
@SystemFw
yes, it's the same thing
they both are convenience terms
they aren't precise
it's just F[_]
dadepo
@dadepo
Great! That clarifies things!
trepidacious
@trepidacious
Good to know I shouldn't be looking for a precise definition :)
Fabio Labella
@SystemFw

it goes like this:

  • purity is a syntactical property of programs, more precisely defined as referential transparency: replacing an expression for its bound value doesn't change meaning (precise definition)
  • side effects are things that break referential transparency (precise definition)
  • There's no direct connection between the concepts of IO, State and so on, and side effects. Traditionally, these things are side effectful (break referential transparency), but you can have abstractions that are pure (don't break ref.trans.)
  • Due to the above, the term purely functional programming is not an oxymoron, it makes perfect sense.
  • In haskell style pure FP, type constructors and algebras are used to represent "things that would otherwise traditionally be side effects (break ref.trans.)". We call these F[_]s effects or computational contexts for brevity. You can see for yourself how this cannot be a precise definition (especially because they could also have kind higher than * -> *, even though most famous algebras like Functor and Monad operate on F[_]

I guess the other thing to add is that purity really matters a lot, it's not pedantry. Referentially transparent expressions respect the substitution model, which means you can use local reasoning only to understand and compose your programs, which is a huge win

trepidacious
@trepidacious
So "effect" is kind of "replacement for side-effect, without a side-effect"
Fabio Labella
@SystemFw
yeah, so necessarily wishy-washy
trepidacious
@trepidacious
That makes sense though, thanks :)
Fabio Labella
@SystemFw
just think about a higher kinded type with some algebras defined for it, really
like "a final tagless api for a DB abstracts over the effect" <-- "takes an F[_], which will have algebras like Monoid, Monad or Sync, most likely"
RoelofWobben
@RoelofWobben
@lysium thanks for letting me see this solution
Otto Chrons
@ochrons
@SystemFw mind explaining "final tagless" while you're on a roll? :)
Fabio Labella
@SystemFw
yep
so, final tagless is a broader term, which is now getting used in a more specific meaning increasingly often
generally speaking final tagless is a technique for encoding DSLs
these days, often it's used to mean "a final tagless encoding of an effectful algebra", like a DB or something
which one are you interested in?
what the term means precisely (final + tagless)
or a primer in the use of it in server side code?

anyway the general idea is simple

trait KVS[F[_]] {
   def put(k: String, v: String): F[Unit]
   def get(k: String): F[Option[String]]
}

F will be replaced by a concrete type like cats.effect.IO, or Kleisli[IO, DbConnection, ?]

that's the gist of it really
Fabio Labella
@SystemFw
(I can give you lots more detail, if you tell me what you care about :) )
@ochrons
Otto Chrons
@ochrons
I have seen "final tagless" getting thrown around, but I have no clue what it means.. like why tag-less? what's the tag?
what would be tagfull? :)
and what are the alternatives to final tagless
Fabio Labella
@SystemFw
ah, ok
I have a longer explanation of that (if you don't mind reading a scroll back)
maybe I can link it to you and you can ask questions ?
it explains what is final vs initial in this context, and why tag-less in the context of a very simple dsl for adding numbers
the gist:
  • in an initial dsl you write a concrete datatype, then you interpret it
  • in a final dsl you write things directly in terms of the functions that will interpret them (I promise the longer explanation is clearer)
when we apply these two philosophies to effects
the initial approach is the Free monad, we create a concrete datatype (Free, basically a tree), then interpret it
Otto Chrons
@ochrons
ok
Fabio Labella
@SystemFw
try reading that link and let me know
Otto Chrons
@ochrons
I did, but since I'm not even familiar with Free it doesn't give much ;)