julien-truffaut on gh-pages
Deploy website Deploy website … (compare)
xuwei-k on master
Update sbt-mdoc to 2.3.3 (#1292) (compare)
julien-truffaut on gh-pages
Deploy website Deploy website … (compare)
xuwei-k on master
Update sbt to 1.7.1 (compare)
going by the doc on traversal
A Traversal is the generalisation of an Optional to several targets. In other word, a Traversal allows to focus from a type S into 0 to n values of type A.
I think all I need is a way to be able to pick leaves of a
type Tree[+A] = Free[Map[String,_], A]
by the path to it's leaves... (need to think if that is the right datastructure first)
.focus(_.foo)
or GenLens[T](_.foo)
I get an error that Select.unique
is not supported for overloaded methods. I did fiddle around with something like f.focus().andThen(_.foo)
which at least compiles but that doesn't seem to be the right direction.
case class Outer(
inner: Option[Inner]
)
case class Inner(
str: String
)
val p = GenLens[Outer](_.inner) composePrism some
val zero = Outer(inner = None)
val n = p.set(Inner("hello"))(zero)
Why do I get Outer(inner = None)
? Shouldn't the some
prism be setting inner
correctly?
private def definingOptional[T](empty: => T) = Optional[Option[T], T] {
case Some(v) => Some(v)
case None => Some(empty)
}(v => _ => Some(v))
Hey guys, i'm kinda confused with a task my prof gave us hopefully one of oyu could help me out ^^
We've got a "database" with dummy values and we need to inspect/get and modify some of the values depending on who requested them
object Database extends Database:
private var data: Map[InsuranceNumber,Item] = Map(
120971233 -> Item(
InsuranceKind.Public,
Name("Ali","Meyer"),
Date(13,Month.Aug,1987),
Address("Karlstraße","1a","D-12849","Wannstadt"),
Seq(TelephoneNo(true,"+49 127 12039123")),
Seq("Excessive Gaming","Flu"),
Date(5, Month.Sep, 2022)
),
12309812 -> Item(
InsuranceKind.Private,
Name("Olga", "Lee"),
Date(12, Month.Mar, 2001),
Address("Blumenweg","14","D-28209","Bremen"),
Seq(TelephoneNo(true,"+49 421 12039812"), TelephoneNo(false,"+49 177 102931823")),
Seq("Covid"),
Date(4, Month.Aug, 2022)
),
So if a patient requests the data, he needs to authenticate using the insurance number and his data of birth
def queryA: A
def updateA(f: A => A): Unit
These two functions should be used to update and retrieve the values but i'm legit stuck at how to approach this problem