From c28de8b4d67bcd1952e900261173d649cad2c750 Mon Sep 17 00:00:00 2001 From: manoj-apj Date: Mon, 16 Mar 2026 07:20:04 +0000 Subject: [PATCH 1/2] Add contributor component for @manoj --- src/main/scala/gsoc/contributors/all.scala | 1 + src/main/scala/gsoc/contributors/manoj.scala | 85 ++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 src/main/scala/gsoc/contributors/manoj.scala diff --git a/src/main/scala/gsoc/contributors/all.scala b/src/main/scala/gsoc/contributors/all.scala index 7c3e4c4..8016c93 100644 --- a/src/main/scala/gsoc/contributors/all.scala +++ b/src/main/scala/gsoc/contributors/all.scala @@ -9,6 +9,7 @@ val allContributors = NonEmptyList.of( gfinol, hehelego, synan_mannan, + `manoj-apj`, antoniojimeneznieto, `tanmay_008`, abh80, diff --git a/src/main/scala/gsoc/contributors/manoj.scala b/src/main/scala/gsoc/contributors/manoj.scala new file mode 100644 index 0000000..85c3ba9 --- /dev/null +++ b/src/main/scala/gsoc/contributors/manoj.scala @@ -0,0 +1,85 @@ +package gsoc +package contributors + +import cats.effect.* +import fs2.concurrent.* +import fs2.dom.HtmlElement +import calico.html.io.{*, given} +import calico.syntax.* + +val `manoj-apj`: Contributor = Contributor("manoj-apj"): + SignallingRef[IO].of(List.empty[String]).toResource.flatMap { items => + SignallingRef[IO].of("").toResource.flatMap { inputText => + div( + styleAttr := "font-family: system-ui, sans-serif;", + h3("Immutable List Explorer"), + p( + i("@manoj-apj"), + " — I agree to follow the Typelevel Code of Conduct and the Typelevel GSoC AI Policy." + ), + p("Linked lists have O(1) prepend but O(n) append. Build your list and feel the difference!"), + div( + input.withSelf { self => + ( + typ := "text", + placeholder := "enter element", + value <-- inputText, + onInput --> (_.foreach(_ => + self.value.get.flatMap(inputText.set) + )) + ) + }, + button( + "Prepend · O(1)", + onClick --> (_.foreach(_ => + inputText.get.flatMap { v => + if v.trim.nonEmpty then + items.update(v.trim :: _) *> inputText.set("") + else IO.unit + } + )) + ), + button( + "Append · O(n)", + onClick --> (_.foreach(_ => + inputText.get.flatMap { v => + if v.trim.nonEmpty then + items.update(_ :+ v.trim) *> inputText.set("") + else IO.unit + } + )) + ), + button( + "Drop Head", + onClick --> (_.foreach(_ => + items.update(l => if l.nonEmpty then l.tail else l) + )) + ), + button( + "Clear", + onClick --> (_.foreach(_ => items.set(Nil))) + ) + ), + p( + styleAttr := "font-family: monospace;", + "List: ", + items.map { + case Nil => "(empty)" + case l => l.mkString("[ ", " :: ", " :: Nil ]") + } + ), + p("Head (O(1)): ", items.map(_.headOption.fold("—")(h => s"\"$h\""))), + p("Size: ", items.map(_.size.toString)), + p( + styleAttr := "background: #f0f4ff; padding: 10px 14px; border-radius: 6px; margin-top: 12px;", + "💡 Have ideas to make immutable lists faster? ", + a( + href := "https://discord.gg/dcAFxD8S", + target := "_blank", + styleAttr := "color: #3355cc; font-weight: bold;", + "Discuss in #summer-of-code on Typelevel Discord →" + ) + ) + ) + } + } From 3719286a26ae5f71de53e73e16756caae7187c2e Mon Sep 17 00:00:00 2001 From: manoj-apj Date: Mon, 16 Mar 2026 08:54:39 +0000 Subject: [PATCH 2/2] Fix CI checks and formatting issues --- src/main/scala/gsoc/contributors/manoj.scala | 31 ++++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/main/scala/gsoc/contributors/manoj.scala b/src/main/scala/gsoc/contributors/manoj.scala index 85c3ba9..8cd38fd 100644 --- a/src/main/scala/gsoc/contributors/manoj.scala +++ b/src/main/scala/gsoc/contributors/manoj.scala @@ -1,11 +1,11 @@ package gsoc package contributors +import calico.html.io.{*, given} +import calico.syntax.* import cats.effect.* import fs2.concurrent.* import fs2.dom.HtmlElement -import calico.html.io.{*, given} -import calico.syntax.* val `manoj-apj`: Contributor = Contributor("manoj-apj"): SignallingRef[IO].of(List.empty[String]).toResource.flatMap { items => @@ -15,7 +15,7 @@ val `manoj-apj`: Contributor = Contributor("manoj-apj"): h3("Immutable List Explorer"), p( i("@manoj-apj"), - " — I agree to follow the Typelevel Code of Conduct and the Typelevel GSoC AI Policy." + " — I agree to follow the Typelevel Code of Conduct and GSoC AI policy." ), p("Linked lists have O(1) prepend but O(n) append. Build your list and feel the difference!"), div( @@ -24,36 +24,28 @@ val `manoj-apj`: Contributor = Contributor("manoj-apj"): typ := "text", placeholder := "enter element", value <-- inputText, - onInput --> (_.foreach(_ => - self.value.get.flatMap(inputText.set) - )) + onInput --> (_.foreach(_ => self.value.get.flatMap(inputText.set))) ) }, button( "Prepend · O(1)", onClick --> (_.foreach(_ => inputText.get.flatMap { v => - if v.trim.nonEmpty then - items.update(v.trim :: _) *> inputText.set("") + if v.trim.nonEmpty then items.update(v.trim :: _) *> inputText.set("") else IO.unit - } - )) + })) ), button( "Append · O(n)", onClick --> (_.foreach(_ => inputText.get.flatMap { v => - if v.trim.nonEmpty then - items.update(_ :+ v.trim) *> inputText.set("") + if v.trim.nonEmpty then items.update(_ :+ v.trim) *> inputText.set("") else IO.unit - } - )) + })) ), button( "Drop Head", - onClick --> (_.foreach(_ => - items.update(l => if l.nonEmpty then l.tail else l) - )) + onClick --> (_.foreach(_ => items.update(l => if l.nonEmpty then l.tail else l))) ), button( "Clear", @@ -65,13 +57,14 @@ val `manoj-apj`: Contributor = Contributor("manoj-apj"): "List: ", items.map { case Nil => "(empty)" - case l => l.mkString("[ ", " :: ", " :: Nil ]") + case l => l.mkString("[ ", " :: ", " :: Nil ]") } ), p("Head (O(1)): ", items.map(_.headOption.fold("—")(h => s"\"$h\""))), p("Size: ", items.map(_.size.toString)), p( - styleAttr := "background: #f0f4ff; padding: 10px 14px; border-radius: 6px; margin-top: 12px;", + styleAttr := + "background: #f0f4ff; padding: 10px 14px; border-radius: 6px; margin-top: 12px;", "💡 Have ideas to make immutable lists faster? ", a( href := "https://discord.gg/dcAFxD8S",