Skip to content

Commit

Permalink
Add Data instance to NonEmptyText (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
glasserc authored Mar 4, 2024
1 parent 598048d commit 8d11985
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.3.1.0] - 2024-02-29

- Add `Data` instance to `NonEmptyText`.

## [0.3.0.1] - 2024-01-03

- Add support for GHC 9.6
Expand Down
4 changes: 3 additions & 1 deletion src/Data/StringVariants/NonEmptyText/Internal.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
Expand All @@ -14,6 +15,7 @@ import Control.Monad (when)
import Data.Aeson (FromJSON (..), ToJSON, withText)
import Data.ByteString
import Data.Coerce
import Data.Data (Data)
import Data.MonoTraversable
import Data.Proxy
import Data.Sequences
Expand All @@ -30,7 +32,7 @@ import Prelude

-- | Non Empty Text, requires the input is between 1 and @n@ chars and not just whitespace.
newtype NonEmptyText (n :: Nat) = NonEmptyText Text
deriving stock (Generic, Show, Read, Lift)
deriving stock (Data, Generic, Show, Read, Lift)
deriving newtype (Eq, Ord, ToJSON, MonoFoldable)

type instance Element (NonEmptyText _n) = Char
Expand Down
2 changes: 1 addition & 1 deletion string-variants.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cabal-version: 1.12
-- see: https://github.com/sol/hpack

name: string-variants
version: 0.3.0.1
version: 0.3.1.0
synopsis: Constrained text newtypes
description: See README at <https://github.com/MercuryTechnologies/string-variants#readme>.
category: Data
Expand Down

0 comments on commit 8d11985

Please sign in to comment.