Skip to content

magaransoft/typed-map

Repository files navigation

Typed Map Tests & Docs

A type-safe map for Scala 3 where each key carries its value type, eliminating runtime casts.

Installation

Typed Map is published to Maven Central. Add the following to your build.sbt:

libraryDependencies += "com.magaran" %% "typed-map" % "0.1.0"

Usage

import com.magaran.typedmap.*

// Define typed keys
object Name extends TypedKey[String]
object Age extends TypedKey[Int]

// Create a map
val map = TypedMap(Name -> "Alice", Age -> 30)

// Retrieve values — type-safe, no casting
val name: String = map(Name)
val age: Int = map(Age)
val maybeName: Option[String] = map.get(Name)

License

MIT

About

Small scala utility library providing safe HashMap like access with typed keys

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors