Skip to content

Commit b4a3ec6

Browse files
committed
Moved IHP.HSX modules into it's own ihp-hsx package
1 parent 20f0379 commit b4a3ec6

File tree

11 files changed

+179
-7
lines changed

11 files changed

+179
-7
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{ mkDerivation
2+
, classy-prelude
3+
, string-conversions
4+
, blaze-html
5+
, blaze-markup
6+
, text
7+
, bytestring
8+
, lib
9+
, basic-prelude
10+
, megaparsec
11+
, template-haskell
12+
, haskell-src-meta
13+
, containers
14+
}:
15+
mkDerivation {
16+
pname = "ihp-hsx";
17+
version = "v0.18.0";
18+
src = ./../../ihp-hsx;
19+
isLibrary = true;
20+
isExecutable = false;
21+
libraryHaskellDepends = [
22+
classy-prelude
23+
string-conversions
24+
blaze-html
25+
blaze-markup
26+
text
27+
bytestring
28+
basic-prelude
29+
megaparsec
30+
template-haskell
31+
haskell-src-meta
32+
containers
33+
];
34+
license = lib.licenses.mit;
35+
enableLibraryForGhci = true;
36+
homepage = "https://ihp.digitallyinduced.com";
37+
configureFlags = ["--enable-optimization=2"];
38+
}

IHP/View/ConvertibleStrings.hs renamed to ihp-hsx/IHP/HSX/ConvertibleStrings.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{-# LANGUAGE TypeFamilies #-}
55
{-# LANGUAGE UndecidableInstances #-}
66

7-
module IHP.View.ConvertibleStrings where
7+
module IHP.HSX.ConvertibleStrings where
88

99
import Prelude
1010
import Data.String.Conversions (ConvertibleStrings (convertString), cs)
File renamed without changes.
File renamed without changes.

IHP/HSX/ToHtml.hs renamed to ihp-hsx/IHP/HSX/ToHtml.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import qualified Text.Blaze.Html5 as Html5
66
import qualified Text.Blaze.Internal
77
import ClassyPrelude
88
import Data.String.Conversions (cs)
9-
import IHP.View.ConvertibleStrings ()
10-
import qualified Data.ByteString
9+
import IHP.HSX.ConvertibleStrings ()
1110

1211
class ToHtml a where
1312
toHtml :: a -> Html5.Html
@@ -18,13 +17,13 @@ instance ToHtml (Text.Blaze.Internal.MarkupM ()) where
1817

1918
instance ToHtml Text where
2019
{-# INLINE toHtml #-}
21-
toHtml = cs
20+
toHtml = Html5.text
2221

2322
instance ToHtml String where
2423
{-# INLINE toHtml #-}
25-
toHtml = cs
24+
toHtml = Html5.string
2625

27-
instance ToHtml Data.ByteString.ByteString where
26+
instance ToHtml ByteString where
2827
{-# INLINE toHtml #-}
2928
toHtml value = toHtml (cs value :: Text)
3029

@@ -34,4 +33,4 @@ instance {-# OVERLAPPABLE #-} ToHtml a => ToHtml (Maybe a) where
3433

3534
instance {-# OVERLAPPABLE #-} Show a => ToHtml a where
3635
{-# INLINE toHtml #-}
37-
toHtml value = cs (show value)
36+
toHtml value = Html5.string (show value)

ihp-hsx/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 digitally induced GmbH
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

ihp-hsx/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# HSX
2+
3+
This directory contains the ihp-hsx package which provides `[hsx|<h1>Hello World</h1>|]` syntax to IHP projects.

ihp-hsx/ihp-hsx.cabal

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
cabal-version: 2.2
2+
name: ihp-hsx
3+
version: 0.18.0
4+
synopsis: JSX-like but for Haskell
5+
description: JSX-like templating syntax for Haskell
6+
license: NONE
7+
license-file: LICENSE
8+
author: digitally induced GmbH
9+
maintainer: [email protected]
10+
-- copyright:
11+
-- category:
12+
build-type: Simple
13+
14+
library
15+
default-language: Haskell2010
16+
build-depends:
17+
base
18+
, classy-prelude
19+
, string-conversions
20+
, blaze-html
21+
, blaze-markup
22+
, text
23+
, bytestring
24+
, basic-prelude
25+
, megaparsec
26+
, template-haskell
27+
, haskell-src-meta
28+
, containers
29+
default-extensions:
30+
OverloadedStrings
31+
, NoImplicitPrelude
32+
, ImplicitParams
33+
, Rank2Types
34+
, NamedFieldPuns
35+
, TypeSynonymInstances
36+
, FlexibleInstances
37+
, DisambiguateRecordFields
38+
, DuplicateRecordFields
39+
, OverloadedLabels
40+
, FlexibleContexts
41+
, DataKinds
42+
, QuasiQuotes
43+
, TypeFamilies
44+
, PackageImports
45+
, ScopedTypeVariables
46+
, RecordWildCards
47+
, TypeApplications
48+
, DataKinds
49+
, InstanceSigs
50+
, DeriveGeneric
51+
, MultiParamTypeClasses
52+
, TypeOperators
53+
, DeriveDataTypeable
54+
, DefaultSignatures
55+
, BangPatterns
56+
, FunctionalDependencies
57+
, PartialTypeSignatures
58+
, BlockArguments
59+
, LambdaCase
60+
, StandaloneDeriving
61+
, TemplateHaskell
62+
ghc-options:
63+
-fstatic-argument-transformation
64+
-funbox-strict-fields
65+
-haddock
66+
-Wredundant-constraints
67+
-Wunused-imports
68+
-Wunused-foralls
69+
-Wmissing-fields
70+
-Winaccessible-code
71+
-Wmissed-specialisations
72+
-Wall-missed-specialisations
73+
-fexpose-all-unfoldings
74+
hs-source-dirs: .
75+
exposed-modules:
76+
IHP.HSX.Parser
77+
, IHP.HSX.QQ
78+
, IHP.HSX.ToHtml
79+
, IHP.HSX.ConvertibleStrings

ihp-hsx/shell.nix

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
let
2+
pkgs = (import ./../NixSupport/make-nixpkgs-from-options.nix) {
3+
ihp = ./../.;
4+
haskellPackagesDir = ./../NixSupport/haskell-packages;
5+
};
6+
ghc = pkgs.haskell.packages.ghc8107;
7+
haskellDeps = ghc.ghcWithPackages (p: with p; [
8+
classy-prelude
9+
string-conversions
10+
blaze-html
11+
blaze-markup
12+
text
13+
bytestring
14+
basic-prelude
15+
megaparsec
16+
template-haskell
17+
haskell-src-meta
18+
containers
19+
20+
# Development Specific Tools
21+
hspec
22+
]);
23+
in
24+
pkgs.stdenv.mkDerivation {
25+
name = "ihp-hsx";
26+
src = ./.;
27+
buildInputs = [haskellDeps];
28+
shellHook = "eval $(egrep ^export ${haskellDeps}/bin/ghc)";
29+
}

ihp.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
, neat-interpolation
6464
, unagi-chan
6565
, with-utf8
66+
, ihp-hsx
6667
}:
6768
mkDerivation {
6869
pname = "ihp";
@@ -132,6 +133,7 @@ mkDerivation {
132133
neat-interpolation
133134
unagi-chan
134135
with-utf8
136+
ihp-hsx
135137
];
136138
license = lib.licenses.mit;
137139
postInstall = ''

0 commit comments

Comments
 (0)