Skip to content

Commit

Permalink
Merge pull request #23 from xquantxz/main
Browse files Browse the repository at this point in the history
Add haskell
  • Loading branch information
thunder04 authored Oct 16, 2023
2 parents d96d789 + d80f698 commit 4972b5b
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- [C++](examples/unofficial/c++.md)
- [Dart](examples/unofficial/dart.md)
- [Go](examples/unofficial/go.md)
- [Haskell](examples/unofficial/haskell.md)
- [Rust](examples/unofficial/rust.md)
<!-- PLEASE ALPHABETICALLY -->

Expand Down
61 changes: 61 additions & 0 deletions src/examples/unofficial/haskell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Haskell

---

## Installation

The [nekos-best](https://hackage.haskell.org/package/nekos-best) package is available on Hackage and can be added to the .cabal file

```
build-depends:
nekos-best ^>= 0.2.0.0,
...
```

## Usage

Get a neko image

```haskell
import NekosBest.API (getNbImage)
import qualified NekosBest.Category as C

main = do
res <- getNbImage C.Neko
print res
```

___

For random images use `randomNbImage` passing a `RandomGen` value

```haskell
import NekosBest.API (randomNbImage)
import qualified NekosBest.Category as C

main = do
gen <- getStdGen
(res, gen') <- randomNbImage gen
print res

```
___

Downloading an image

```haskell
import NekosBest.API (getNbImage, downloadNbImage)
import qualified NekosBest.Category as C

main = do
res <- getNbImage C.Neko
mapM_ (\x -> downloadNbImage x "filename") res
```

## About

> Example added by: [**xQuantx**](https://github.com/xquantxz)
>
> The source code is available at [**GitHub**](https://github.com/xquantxz/nekos-best.hs)
>
> ![NekosBest](https://img.shields.io/hackage/v/nekos-best.svg) ![NekosBest](https://img.shields.io/github/license/xquantxz/nekos-best%2ehs.svg) ![NekoBest](https://img.shields.io/github/issues/xquantxz/nekos-best%2ehs.svg)

0 comments on commit 4972b5b

Please sign in to comment.