MyNixOS website logo
Description

Turn any English text into nonsensical babyspeaks.

Please see the README on GitHub at https://github.com/deadshot465/owoify-hs#readme

owoify-hs

Turning your worst nightmare into a Haskell package.

Haskell CI

This is a Haskell port of mohan-cao's owoify-js, which will help you turn any string into nonsensical babyspeak similar to LeafySweet's infamous Chrome extension.

Just like my other Owoify ports, three levels of owoness are available. Each level has been implemented using a discriminated union, so it should work like enums people are used to seeing in other imperative languages.

  1. owo (default): The most vanilla one.
  2. uwu: The moderate one.
  3. uvu: Litewawwy unweadabwal. Please refer to the original owoify-js repository for more information.

Functional programming is fun, so of course I'll port it to FP languages. 😜

Also I love Haskell. ❤️

Reason for development

Because I love Haskell and currently Hackage doesn't have any owoify package yet. Also PureScript is influenced by Haskell and they have nearly the same syntax, so it doesn't make sense to have a PureScript port while not having a Haskell port.

The difference is that owoify-hs makes use of Haskell's lazy evaluation. Data.Text.Lazy is used instead of Data.Text. This possibly solved stack overflow problem with purescript-owoify when owoifying very long texts (i.e. chapter 1-20 of Tolstoy's War and Peace). The reason for using Data.Text.Lazy.Text instead of the good old String is because Data.Text.Lazy.Text and the eager version Data.Text.Text are meant for handling Unicode texts.

Having said that, you would need to do Data.Text.Lazy.pack <text> before passing the text to the owoify function.

Install instructions

Add owoify-hs to your package.yaml in your Stack project:

dependencies:
- owoify-hs == 1.1.0.0

If you are using Cabal, add the package the usual way.

cabal install owoify-hs

Usage

owoify-hs is implemented as a single function. You will need to provide a source string and a owoify level. Due to random number generator and regular expressions, the result will be inside IO monad, so you will also need to handle that.

module MyAwesomeModule where

import Prelude

import Data.Owoify.Owoify (OwoifyLevel(..), owoify)
import Data.Text.Lazy (pack, unpack)

main :: IO ()
main = do
  owoResult <- owoify (pack "This is the string to owo! Kinda cute, isn't it?") Owo
  uvuResult <- owoify (pack "This is the string to owo! Kinda cute, isn't it?") Uvu
  -- `print` won't print out Unicode emojis correctly.
  putStrLn $ unpack owoResult
  putStrLn $ unpack uvuResult

-- Possible outputs:
-- This is teh stwing two owo! Kinda cute, isn't it?
-- fwis is teh stwing two owowouvu Kinda cuteowo isn't it?

Disclaimer

As usual, I'm writing this package for both practicing and bots' needs. Performance is NOT guaranteed.

That being said, Data.Text.Lazy is used, so it should be able to handle both short texts and long texts without any problem.

See also

  • owoify-js - The original owoify-js repository.
  • Owoify.Net - The C# port of Owoify written by me.
  • Owoify++ - The C++ header-only port of Owoify written by me.
  • owoify_rs - The Rust port of Owoify written by me.
  • owoify-py - The Python port of Owoify written by me.
  • owoify_dart - The Dart port of Owoify written by me.
  • owoify_rb - The Ruby port of Owoify written by me.
  • owoify-go - The Go port of Owoify written by me.
  • owoifySwift - The Swift port of Owoify written by me.
  • owoifyKt - The Kotlin port of Owoify written by me.
  • owoify_ex - The Elixir port of Owoify written by me.
  • owoify_cr - The Crystal port of Owoify written by me.
  • owoifynim - The Nim port of Owoify written by me.
  • owoify-clj - The Clojure port of Owoify written by me.
  • purescript-owoify - The PureScript port of Owoify written by me.

License

MIT License

Copyright (c) 2023 Chehui Chou

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Version

1.1.0.0

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows