ihp 1.4.0 → 1.4.1
raw patch · 4 files changed
+24/−15 lines, 4 files
Files
- CHANGELOG.md +8/−1
- IHP/ModelSupport.hs +3/−1
- IHP/NameSupport.hs +12/−12
- ihp.cabal +1/−1
CHANGELOG.md view
@@ -1,4 +1,11 @@-# v1.4.0 (unreleased)+# v1.4.1++- ihp-{openai,sitemap}: increase base bounds from 4.20 => 4.22+- fix migrate package+- use Data.Text qualified in IHP.NameSupport to fix build with text-2.1.2+- Drop 'Default Bool' instance for data-default >= 0.8++# v1.4.0 ## Highlights - 🚀 Improved Dev Server: faster, more reliable reloads without race conditions.
IHP/ModelSupport.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE MultiParamTypeClasses, TypeFamilies, FlexibleContexts, AllowAmbiguousTypes, UndecidableInstances, FlexibleInstances, IncoherentInstances, DataKinds, PolyKinds, TypeApplications, ScopedTypeVariables, ConstraintKinds, TypeOperators, GADTs, GeneralizedNewtypeDeriving #-}+{-# LANGUAGE MultiParamTypeClasses, TypeFamilies, FlexibleContexts, AllowAmbiguousTypes, UndecidableInstances, FlexibleInstances, IncoherentInstances, DataKinds, PolyKinds, TypeApplications, ScopedTypeVariables, ConstraintKinds, TypeOperators, GADTs, GeneralizedNewtypeDeriving, CPP #-} module IHP.ModelSupport ( module IHP.ModelSupport@@ -182,9 +182,11 @@ {-# INLINE def #-} def = "" +#if !MIN_VERSION_data_default(0,8,0) instance Default Bool where {-# INLINE def #-} def = False+#endif instance Default Point where def = Point def def
IHP/NameSupport.hs view
@@ -23,7 +23,7 @@ import Prelude hiding (splitAt, words, map) import IHP.HaskellSupport-import Data.Text+import Data.Text (Text) import Data.String.Conversions (cs) import qualified Data.Char as Char import qualified Text.Inflections as Inflector@@ -45,7 +45,7 @@ tableNameToModelName "brain_waves" = "BrainWave" tableNameToModelName tableName = do let singularizedTableName = cs (singularize tableName)- if "_" `isInfixOf` singularizedTableName+ if "_" `Text.isInfixOf` singularizedTableName then unwrapEither tableName $ Inflector.toCamelCased True $ singularizedTableName else ucfirst singularizedTableName {-# INLINABLE tableNameToModelName #-}@@ -62,7 +62,7 @@ -- "UserProjects" tableNameToControllerName :: Text -> Text tableNameToControllerName tableName = do- if "_" `isInfixOf` tableName+ if "_" `Text.isInfixOf` tableName then unwrapEither tableName $ Inflector.toCamelCased True tableName else ucfirst tableName {-# INLINABLE tableNameToControllerName #-}@@ -94,7 +94,7 @@ words :: [Inflector.SomeWord] words = enumValue- |> splitOn " "+ |> Text.splitOn " " |> List.map (Inflector.parseSnakeCase []) |> List.map (\case Left failed -> error (cs $ "enumValueToControllerName failed for " <> show failed)@@ -151,7 +151,7 @@ {-# INLINABLE applyFirst #-} applyFirst :: (Text -> Text) -> Text -> Text applyFirst f text =- let (first, rest) = splitAt 1 text+ let (first, rest) = Text.splitAt 1 text in (f first) <> rest -- | Make a text's first character lowercase@@ -162,7 +162,7 @@ -- >>> lcfirst "alread lowercase" -- "already lowercase" lcfirst :: Text -> Text-lcfirst = applyFirst toLower+lcfirst = applyFirst Text.toLower {-# INLINABLE lcfirst #-} -- | Make a text's first character uppercase@@ -173,7 +173,7 @@ -- >>> ucfirst "Already uppercase" -- "Already uppercase" ucfirst :: Text -> Text-ucfirst = applyFirst toUpper+ucfirst = applyFirst Text.toUpper {-# INLINABLE ucfirst #-} -- | Add '_' to the end of a name if it is a reserved haskell keyword@@ -184,7 +184,7 @@ -- >>> escapeHaskellKeyword "type" -- "type_" escapeHaskellKeyword :: Text -> Text-escapeHaskellKeyword name = if toLower name `Prelude.elem` haskellKeywords then name <> "_" else name+escapeHaskellKeyword name = if Text.toLower name `Prelude.elem` haskellKeywords then name <> "_" else name haskellKeywords :: [Text] haskellKeywords = [ "_"@@ -247,10 +247,10 @@ toSlug :: Text -> Text toSlug text = text- |> toLower- |> map replaceChar- |> words- |> intercalate "-"+ |> Text.toLower+ |> Text.map replaceChar+ |> Text.words+ |> Text.intercalate "-" where replaceChar 'ä' = 'a' replaceChar 'ö' = 'o'
ihp.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: ihp-version: 1.4.0+version: 1.4.1 synopsis: Haskell Web Framework description: The Integrated Haskell Platform is a full stack framework focused on rapid application development while striving for robust code quality. Full guide available at: <https://ihp.digitallyinduced.com/Guide/index.html>