Skip to content

Commit

Permalink
doc updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ireina7 committed May 21, 2023
1 parent d506a7e commit 8c66fb0
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
# summoner
# Summoner
Typeclass system and dependency injection for Golang.

Let's summon magic!

![banner](banner.jpg)


---
## Getting started
### Get me
```shell
go get -u github.com/ireina7/summoner
```

### Usage
```go
import "fmt"
import summoner "github.com/ireina7/summoner"

func Summon[A any]() (A, error) {
return summoner.Summon[A]()
}

func Given[A any](a A) error {
return summoner.Given(a)
}


func main() {
Given[int](0) // Default integer!

fmt.Println(Summon[int]())
}
```



## Basic dependency injection
You can use `summoner` to achieve simple typeclass function.
For example, if you want to have a typeclass `Show`,
Expand Down Expand Up @@ -91,4 +125,7 @@ func main() {
fmt.Println(sp.Debug(Person{0, "Tom", 10}))
}

```
```

## Contribution
Any new ideas?

0 comments on commit 8c66fb0

Please sign in to comment.