scalaz - point reader monad scala -


is there way, how point value in reader context?
can use reader object , ignore context:

reader {   _ ⇒ 3 } 
scalaz seems have method point specifically. see, defined on applicative. suppose, there trick, how put value reader context.

there in fact applicative instance reader, can use (you should of course replace string whatever type want environment be):

3.point[({type l[x] = reader[string, x]})#l] 

if you'd prefer avoid ugly type lambda , don't mind defining type alias, can write following instead:

type myreader[x] = reader[string, x]  3.point[myreader] 

scalaz 7 provides nice bit of shorthand makes cleaner:

3.liftreader[string] 

these more or less equivalent each other (and solution), though.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -