Git Product home page Git Product logo

toolkit's Introduction

Typelevel Toolkit

A toolkit of great libraries to get started building Typelevel apps on JVM, Node.js, and Native! Our very own flavour of the Scala Toolkit.

//> using toolkit typelevel:latest

import cats.effect.*

object Hello extends IOApp.Simple:
  def run = IO.println("Hello toolkit!")

To get started, you can use the accompanying template :

scala-cli --power new typelevel/toolkit.g8

Libraries included

toolkit's People

Contributors

armanbilge avatar kristianan avatar lenguyenthanh avatar mergify[bot] avatar toniogela avatar typelevel-steward[bot] avatar ubaldop avatar zetashift avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

toolkit's Issues

Which libraries?

The current choices mirror what's in the official Scala Toolkit (sttp, upickle, oslib). I also added Decline :)

toolkit/build.sbt

Lines 17 to 25 in e644ae5

libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % "2.9.0",
"org.typelevel" %%% "cats-effect" % "3.4.8",
"co.fs2" %%% "fs2-io" % "3.6.1",
"org.http4s" %%% "http4s-ember-client" % "0.23.18",
"io.circe" %%% "circe-core" % "0.14.4",
"org.http4s" %%% "http4s-circe" % "0.23.18",
"com.monovore" %%% "decline" % "2.4.1",
"org.typelevel" %%% "munit-cats-effect" % "2.0.0-M3" // not % Test, on purpose :)

But ... it's all bikesheddable :)

v0.1.0

Anything we wanna do prior to a first release? :)

Some fun, simple, examples for common scripts and stuff!

Here's the one posed by Virtus Lab:

Imagine you have a common business problem to solve. You need to write a program that fetches text from a web service and then creates a file in the local filesystem with content and path based on the downloaded information.

Scala Toolkit is getting a bunch of tutorials / examples, we can cheat by copying those and then slapping on a parTraverse ๐Ÿ˜

Kitchen Sink import

A common complaint is about the enormous amount of imports it takes to do stuff. e.g. http4s/http4s#6696

What if ... we just exported a bunch of useful stuff under a single package?

package typelevel.toolkit

export cats.*
export cats.effect.*
export fs2.*
export org.http4s.*
export org.http4s.ember.client.EmberClientBuilder
// etc.

Not gonna lie, it's playing with fire a bit. Probably instead of wildcards we should be thoughtful about the specific things we export.

But then:

import typelevel.toolkit.*

and you are off to the races!

Drop Scala 2.12

Scala Toolkit supports 2.12. All of our libraries do so far, so it's not any extra effort to do it here.

But, why. Here you go @SethTisue ๐Ÿ˜œ

Adding tests in CI

It will be helpful to have tests in CI that check that the toolkit is able to compile a few test scripts.

I'm not sure we can achieve something like this, but we can try. WDYT @armanbilge?

Example script doesn't print anything

I ran the example code from the README and it doesn't print anything:

โžœ  toolkit git:(main) โœ— scala-cli toolkit.sc
Compiling project (Scala 3.2.2, JVM)
Compiled project (Scala 3.2.2, JVM)
โžœ  toolkit git:(main) โœ— 

I'm not sure if this is because of scala-cli or Cats Effect.

Opinionated default implementations of common tasks in scripts.

Languages like python provide really fast and simple ways to perform most operations, which lends itself very well to scripting.
I think that Scala fails at this, while it's better than Java it's still not great. I don't think this is a problem for most situations.

I do however think it would be very nice if toolkit could provide default implementations of some common tasks in a referential transparent and resource-safe way. An example would be reading and writing files.

I'm pretty new to using CE so I ended up writing this, which I'm not even sure is the correct way to do this.

def fileWriter(path: String): Resource[IO, FileWriter] = 
    Resource.make(IO.blocking(new FileWriter(new File(name))))(file => IO.blocking(file.close()))
def openFile(path: String) : Resource[IO, Source] = 
    Resource.make(IO.blocking(Source.fromFile(path)))(file => IO.blocking(file.close()))

def writeToFile(path: String, content: String) =
    fileWriter(path).use(writer => IO.blocking(writer.write(content)))

if instead similar operations were already implemented for me I think that would be really great. It would at least make it a lot easier to convince other people to use this :)

All of this might obviously be outside of the scope of toolkit as it's a collection of libraries, but it would certainly make it easier to pick up for people who just want something to write small tools with.

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.