packages feed

fluent-1.1.0: test/Prelude.hs

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE PackageImports #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-name-shadowing #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Prelude
    ( module Prelude
    , module Data.Scientific
    , module Data.Text
    , module Language.Fluent
    , module Test.Hspec
    )
where

import Data.Scientific (Scientific)
import Data.String (IsString (..))
import Data.Text (Text)
import Data.Text qualified as Text
import Language.Fluent
import Language.Fluent.Bundle qualified as Bundle
import Language.Fluent.Locale.English (English (..))
import Language.Fluent.Parser qualified as Parser
import Test.Hspec
import "base" Prelude

instance IsString Identifier where
    fromString = either error id . Parser.parseIdentifier . Text.pack

instance (r ~ Either String Text) => Translate (Resource -> r) where
    translate reference =
        translate reference
            . Bundle.override (Bundle.UseIsolating False)
            . bundle (pure English)
            . pure