From 8c3f27df65b9f1263d72ec17cd52ffc963f92e73 Mon Sep 17 00:00:00 2001 From: Krishna Padmasola Date: Tue, 10 Oct 2023 16:02:06 +0530 Subject: [PATCH 1/7] Build with GHC 9.6.2 --- Dockerfile | 4 ++-- lib/Language/Souffle/Class.hs | 24 ++++++++++++------------ lib/Language/Souffle/Marshal.hs | 12 ++++++------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index bfae61d..7a48fe1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,9 +10,9 @@ ENV LANGUAGE en_US:en RUN apt-get update \ && apt-get install -y build-essential curl libffi-dev libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 locales \ && echo "source /root/.ghcup/env" >> ~/.bashrc \ - # install ghcup, ghc-9.4.4 and cabal-3.8.1.0 + # install ghcup, ghc-9.6.2 and cabal-3.10.1.0 && curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \ - BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.4.4 BOOTSTRAP_HASKELL_CABAL_VERSION=3.8.1.0 \ + BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.6.2 BOOTSTRAP_HASKELL_CABAL_VERSION=3.10.1.0 \ BOOTSTRAP_HASKELL_INSTALL_STACK=1 BOOTSTRAP_HASKELL_INSTALL_HLS=1 BOOTSTRAP_HASKELL_ADJUST_BASHRC=P sh \ && source /root/.ghcup/env \ && cabal install hpack \ diff --git a/lib/Language/Souffle/Class.hs b/lib/Language/Souffle/Class.hs index cf1588f..7d4f086 100644 --- a/lib/Language/Souffle/Class.hs +++ b/lib/Language/Souffle/Class.hs @@ -64,9 +64,9 @@ type family IsInput fact dir where IsInput _ 'Input = () IsInput _ 'InputOutput = () IsInput fact dir = TypeError - ( 'Text "You tried to use an " ':<>: 'ShowType (FormatDirection dir) ':<>: 'Text " fact of type " ':<>: 'ShowType fact ':<>: 'Text " as an input." - ':$$: 'Text "Possible solution: change the FactDirection of " ':<>: 'ShowType fact - ':<>: 'Text " to either 'Input' or 'InputOutput'." + ( 'Text "You tried to use an " ' :<>: 'ShowType (FormatDirection dir) ' :<>: 'Text " fact of type " ' :<>: 'ShowType fact ' :<>: 'Text " as an input." + ' :$$: 'Text "Possible solution: change the FactDirection of " ' :<>: 'ShowType fact + ' :<>: 'Text " to either 'Input' or 'InputOutput'." ) type IsOutput :: Type -> Direction -> Constraint @@ -74,9 +74,9 @@ type family IsOutput fact dir where IsOutput _ 'Output = () IsOutput _ 'InputOutput = () IsOutput fact dir = TypeError - ( 'Text "You tried to use an " ':<>: 'ShowType (FormatDirection dir) ':<>: 'Text " fact of type " ':<>: 'ShowType fact ':<>: 'Text " as an output." - ':$$: 'Text "Possible solution: change the FactDirection of " ':<>: 'ShowType fact - ':<>: 'Text " to either 'Output' or 'InputOutput'." + ( 'Text "You tried to use an " ' :<>: 'ShowType (FormatDirection dir) ' :<>: 'Text " fact of type " ' :<>: 'ShowType fact ' :<>: 'Text " as an output." + ' :$$: 'Text "Possible solution: change the FactDirection of " ' :<>: 'ShowType fact + ' :<>: 'Text " to either 'Output' or 'InputOutput'." ) type FormatDirection :: Direction -> Symbol @@ -96,12 +96,12 @@ type family ContainsFact prog fact where type CheckContains :: Type -> [Type] -> Type -> Constraint type family CheckContains prog facts fact :: Constraint where CheckContains prog '[] fact = - TypeError ('Text "You tried to perform an action with a fact of type '" ':<>: 'ShowType fact - ':<>: 'Text "' for program '" ':<>: 'ShowType prog ':<>: 'Text "'." - ':$$: 'Text "The program contains the following facts: " ':<>: 'ShowType (ProgramFacts prog) ':<>: 'Text "." - ':$$: 'Text "It does not contain fact: " ':<>: 'ShowType fact ':<>: 'Text "." - ':$$: 'Text "You can fix this error by adding the type '" ':<>: 'ShowType fact - ':<>: 'Text "' to the ProgramFacts type in the Program instance for " ':<>: 'ShowType prog ':<>: 'Text ".") + TypeError ('Text "You tried to perform an action with a fact of type '" ' :<>: 'ShowType fact + ' :<>: 'Text "' for program '" ' :<>: 'ShowType prog ' :<>: 'Text "'." + ' :$$: 'Text "The program contains the following facts: " ' :<>: 'ShowType (ProgramFacts prog) ' :<>: 'Text "." + ' :$$: 'Text "It does not contain fact: " ' :<>: 'ShowType fact ' :<>: 'Text "." + ' :$$: 'Text "You can fix this error by adding the type '" ' :<>: 'ShowType fact + ' :<>: 'Text "' to the ProgramFacts type in the Program instance for " ' :<>: 'ShowType prog ' :<>: 'Text ".") CheckContains _ (a ': _) a = () CheckContains prog (_ ': as) b = CheckContains prog as b diff --git a/lib/Language/Souffle/Marshal.hs b/lib/Language/Souffle/Marshal.hs index 6b242d5..ce73c28 100644 --- a/lib/Language/Souffle/Marshal.hs +++ b/lib/Language/Souffle/Marshal.hs @@ -179,14 +179,14 @@ type family ProductLike t f where ProductLike t (M1 _ _ a) = ProductLike t a ProductLike _ (K1 _ _) = () ProductLike t (_ :+: _) = - TypeError ( 'Text "Error while deriving marshalling code for type " ':<>: 'ShowType t ':<>: 'Text ":" - ':$$: 'Text "Cannot derive sum type, only product types are supported.") + TypeError ( 'Text "Error while deriving marshalling code for type " ' :<>: 'ShowType t ' :<>: 'Text ":" + ' :$$: 'Text "Cannot derive sum type, only product types are supported.") ProductLike t U1 = - TypeError ( 'Text "Error while deriving marshalling code for type " ':<>: 'ShowType t ':<>: 'Text ":" - ':$$: 'Text "Cannot automatically derive code for 0 argument constructor.") + TypeError ( 'Text "Error while deriving marshalling code for type " ' :<>: 'ShowType t ' :<>: 'Text ":" + ' :$$: 'Text "Cannot automatically derive code for 0 argument constructor.") ProductLike t V1 = - TypeError ( 'Text "Error while deriving marshalling code for type " ':<>: 'ShowType t ':<>: 'Text ":" - ':$$: 'Text "Cannot derive void type.") + TypeError ( 'Text "Error while deriving marshalling code for type " ' :<>: 'ShowType t ' :<>: 'Text ":" + ' :$$: 'Text "Cannot derive void type.") type OnlyMarshallableFields :: (Type -> Type) -> Constraint type family OnlyMarshallableFields f where From 2378e8838d4f1804258051311420491c178f4ba7 Mon Sep 17 00:00:00 2001 From: Krishna Padmasola Date: Tue, 10 Oct 2023 17:32:49 +0530 Subject: [PATCH 2/7] Tweak PATH for the build to find `hpack` --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 7a48fe1..61b486c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ ENV LANGUAGE en_US:en # install packages RUN apt-get update \ && apt-get install -y build-essential curl libffi-dev libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 locales \ - && echo "source /root/.ghcup/env" >> ~/.bashrc \ + && echo "source /root/.ghcup/env\nPATH=$PATH:/root/.local/bin\n" >> ~/.bashrc \ # install ghcup, ghc-9.6.2 and cabal-3.10.1.0 && curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \ BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.6.2 BOOTSTRAP_HASKELL_CABAL_VERSION=3.10.1.0 \ From bbdbac8a494e10969ce5501a0e74ca6cb6661414 Mon Sep 17 00:00:00 2001 From: Krishna Padmasola Date: Tue, 10 Oct 2023 18:52:04 +0530 Subject: [PATCH 3/7] Adjust PATH for the build to find `hpack` --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 61b486c..1154ebd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ ENV LANGUAGE en_US:en # install packages RUN apt-get update \ && apt-get install -y build-essential curl libffi-dev libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 locales \ - && echo "source /root/.ghcup/env\nPATH=$PATH:/root/.local/bin\n" >> ~/.bashrc \ + && echo "source /root/.ghcup/env" >> ~/.bashrc \ # install ghcup, ghc-9.6.2 and cabal-3.10.1.0 && curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \ BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_GHC_VERSION=9.6.2 BOOTSTRAP_HASKELL_CABAL_VERSION=3.10.1.0 \ @@ -34,7 +34,8 @@ ENTRYPOINT [ "/app/build/entrypoint.sh" ] COPY . . -RUN source /root/.ghcup/env \ +RUN PATH=$PATH:/root/.local/bin \ + && source /root/.ghcup/env \ && cabal update \ && make configure \ && make build From 142a3a982169bf52964822addedca52b0d40f60d Mon Sep 17 00:00:00 2001 From: Krishna Padmasola Date: Tue, 10 Oct 2023 20:23:03 +0530 Subject: [PATCH 4/7] Setting PATH for build to find `hpack` --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1154ebd..c710f0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,8 +34,8 @@ ENTRYPOINT [ "/app/build/entrypoint.sh" ] COPY . . -RUN PATH=$PATH:/root/.local/bin \ - && source /root/.ghcup/env \ +RUN source /root/.ghcup/env \ + && export PATH=$PATH:/root/.local/bin \ && cabal update \ && make configure \ && make build From 95a8bf687f3878db798c4da30d4c40f5a980840b Mon Sep 17 00:00:00 2001 From: Krishna Padmasola Date: Wed, 11 Oct 2023 11:03:05 +0530 Subject: [PATCH 5/7] Fix `PATH` to make `hpack` available to build --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c710f0d..7d63fd7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,8 @@ SHELL [ "/bin/bash", "-c" ] ENV LC_ALL en_US.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en +# Set the PATH variable to include a custom directory +ENV PATH="${PATH}:/root/.local/bin" # install packages RUN apt-get update \ @@ -35,7 +37,6 @@ ENTRYPOINT [ "/app/build/entrypoint.sh" ] COPY . . RUN source /root/.ghcup/env \ - && export PATH=$PATH:/root/.local/bin \ && cabal update \ && make configure \ && make build From 5c95c120ad9152d82fe6174939d71fa988610e85 Mon Sep 17 00:00:00 2001 From: Krishna Padmasola Date: Wed, 11 Oct 2023 12:00:07 +0530 Subject: [PATCH 6/7] Cleanup disk space by removing docker images --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3669e96..984fe0b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,7 @@ jobs: # Workaround for 'No space left on device' error - name: free disk space run: | + sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true sudo swapoff -a sudo rm -f /swapfile sudo apt clean From 792877d60192db21641bfdbe09c1cb1e99040bce Mon Sep 17 00:00:00 2001 From: Krishna Padmasola Date: Wed, 11 Oct 2023 20:52:57 +0530 Subject: [PATCH 7/7] Suppress some warnings with `-Wno-operator-whitespace` --- lib/Language/Souffle/Class.hs | 24 ++++++++++++------------ lib/Language/Souffle/Marshal.hs | 12 ++++++------ package.yaml | 1 + souffle-haskell.cabal | 6 +++--- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/lib/Language/Souffle/Class.hs b/lib/Language/Souffle/Class.hs index 7d4f086..cf1588f 100644 --- a/lib/Language/Souffle/Class.hs +++ b/lib/Language/Souffle/Class.hs @@ -64,9 +64,9 @@ type family IsInput fact dir where IsInput _ 'Input = () IsInput _ 'InputOutput = () IsInput fact dir = TypeError - ( 'Text "You tried to use an " ' :<>: 'ShowType (FormatDirection dir) ' :<>: 'Text " fact of type " ' :<>: 'ShowType fact ' :<>: 'Text " as an input." - ' :$$: 'Text "Possible solution: change the FactDirection of " ' :<>: 'ShowType fact - ' :<>: 'Text " to either 'Input' or 'InputOutput'." + ( 'Text "You tried to use an " ':<>: 'ShowType (FormatDirection dir) ':<>: 'Text " fact of type " ':<>: 'ShowType fact ':<>: 'Text " as an input." + ':$$: 'Text "Possible solution: change the FactDirection of " ':<>: 'ShowType fact + ':<>: 'Text " to either 'Input' or 'InputOutput'." ) type IsOutput :: Type -> Direction -> Constraint @@ -74,9 +74,9 @@ type family IsOutput fact dir where IsOutput _ 'Output = () IsOutput _ 'InputOutput = () IsOutput fact dir = TypeError - ( 'Text "You tried to use an " ' :<>: 'ShowType (FormatDirection dir) ' :<>: 'Text " fact of type " ' :<>: 'ShowType fact ' :<>: 'Text " as an output." - ' :$$: 'Text "Possible solution: change the FactDirection of " ' :<>: 'ShowType fact - ' :<>: 'Text " to either 'Output' or 'InputOutput'." + ( 'Text "You tried to use an " ':<>: 'ShowType (FormatDirection dir) ':<>: 'Text " fact of type " ':<>: 'ShowType fact ':<>: 'Text " as an output." + ':$$: 'Text "Possible solution: change the FactDirection of " ':<>: 'ShowType fact + ':<>: 'Text " to either 'Output' or 'InputOutput'." ) type FormatDirection :: Direction -> Symbol @@ -96,12 +96,12 @@ type family ContainsFact prog fact where type CheckContains :: Type -> [Type] -> Type -> Constraint type family CheckContains prog facts fact :: Constraint where CheckContains prog '[] fact = - TypeError ('Text "You tried to perform an action with a fact of type '" ' :<>: 'ShowType fact - ' :<>: 'Text "' for program '" ' :<>: 'ShowType prog ' :<>: 'Text "'." - ' :$$: 'Text "The program contains the following facts: " ' :<>: 'ShowType (ProgramFacts prog) ' :<>: 'Text "." - ' :$$: 'Text "It does not contain fact: " ' :<>: 'ShowType fact ' :<>: 'Text "." - ' :$$: 'Text "You can fix this error by adding the type '" ' :<>: 'ShowType fact - ' :<>: 'Text "' to the ProgramFacts type in the Program instance for " ' :<>: 'ShowType prog ' :<>: 'Text ".") + TypeError ('Text "You tried to perform an action with a fact of type '" ':<>: 'ShowType fact + ':<>: 'Text "' for program '" ':<>: 'ShowType prog ':<>: 'Text "'." + ':$$: 'Text "The program contains the following facts: " ':<>: 'ShowType (ProgramFacts prog) ':<>: 'Text "." + ':$$: 'Text "It does not contain fact: " ':<>: 'ShowType fact ':<>: 'Text "." + ':$$: 'Text "You can fix this error by adding the type '" ':<>: 'ShowType fact + ':<>: 'Text "' to the ProgramFacts type in the Program instance for " ':<>: 'ShowType prog ':<>: 'Text ".") CheckContains _ (a ': _) a = () CheckContains prog (_ ': as) b = CheckContains prog as b diff --git a/lib/Language/Souffle/Marshal.hs b/lib/Language/Souffle/Marshal.hs index ce73c28..6b242d5 100644 --- a/lib/Language/Souffle/Marshal.hs +++ b/lib/Language/Souffle/Marshal.hs @@ -179,14 +179,14 @@ type family ProductLike t f where ProductLike t (M1 _ _ a) = ProductLike t a ProductLike _ (K1 _ _) = () ProductLike t (_ :+: _) = - TypeError ( 'Text "Error while deriving marshalling code for type " ' :<>: 'ShowType t ' :<>: 'Text ":" - ' :$$: 'Text "Cannot derive sum type, only product types are supported.") + TypeError ( 'Text "Error while deriving marshalling code for type " ':<>: 'ShowType t ':<>: 'Text ":" + ':$$: 'Text "Cannot derive sum type, only product types are supported.") ProductLike t U1 = - TypeError ( 'Text "Error while deriving marshalling code for type " ' :<>: 'ShowType t ' :<>: 'Text ":" - ' :$$: 'Text "Cannot automatically derive code for 0 argument constructor.") + TypeError ( 'Text "Error while deriving marshalling code for type " ':<>: 'ShowType t ':<>: 'Text ":" + ':$$: 'Text "Cannot automatically derive code for 0 argument constructor.") ProductLike t V1 = - TypeError ( 'Text "Error while deriving marshalling code for type " ' :<>: 'ShowType t ' :<>: 'Text ":" - ' :$$: 'Text "Cannot derive void type.") + TypeError ( 'Text "Error while deriving marshalling code for type " ':<>: 'ShowType t ':<>: 'Text ":" + ':$$: 'Text "Cannot derive void type.") type OnlyMarshallableFields :: (Type -> Type) -> Constraint type family OnlyMarshallableFields f where diff --git a/package.yaml b/package.yaml index 6ffbeb5..c45e352 100644 --- a/package.yaml +++ b/package.yaml @@ -44,6 +44,7 @@ ghc-options: - -Wno-monomorphism-restriction - -Wno-prepositive-qualified-module - -Wno-missing-safe-haskell-mode + - -Wno-operator-whitespace - -optP-Wno-nonportable-include-path - -fhide-source-paths - -fno-show-valid-hole-fits diff --git a/souffle-haskell.cabal b/souffle-haskell.cabal index 3d3ce35..7ca42a3 100644 --- a/souffle-haskell.cabal +++ b/souffle-haskell.cabal @@ -96,7 +96,7 @@ library OverloadedStrings ScopedTypeVariables StandaloneKindSignatures - ghc-options: -Wall -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude -Wno-missed-specializations -Wno-all-missed-specializations -Wno-missing-import-lists -Wno-type-defaults -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -optP-Wno-nonportable-include-path -fhide-source-paths -fno-show-valid-hole-fits -fno-sort-valid-hole-fits + ghc-options: -Wall -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude -Wno-missed-specializations -Wno-all-missed-specializations -Wno-missing-import-lists -Wno-type-defaults -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -Wno-operator-whitespace -optP-Wno-nonportable-include-path -fhide-source-paths -fno-show-valid-hole-fits -fno-sort-valid-hole-fits cxx-options: -std=c++17 -Wall include-dirs: cbits @@ -189,7 +189,7 @@ test-suite souffle-haskell-test OverloadedStrings ScopedTypeVariables StandaloneKindSignatures - ghc-options: -Wall -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude -Wno-missed-specializations -Wno-all-missed-specializations -Wno-missing-import-lists -Wno-type-defaults -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -optP-Wno-nonportable-include-path -fhide-source-paths -fno-show-valid-hole-fits -fno-sort-valid-hole-fits -Wno-missing-kind-signatures -Wno-operator-whitespace + ghc-options: -Wall -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude -Wno-missed-specializations -Wno-all-missed-specializations -Wno-missing-import-lists -Wno-type-defaults -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -Wno-operator-whitespace -optP-Wno-nonportable-include-path -fhide-source-paths -fno-show-valid-hole-fits -fno-sort-valid-hole-fits -Wno-missing-kind-signatures -Wno-operator-whitespace cxx-options: -std=c++17 -D__EMBEDDED_SOUFFLE__ include-dirs: cbits @@ -278,7 +278,7 @@ benchmark souffle-haskell-benchmarks OverloadedStrings ScopedTypeVariables StandaloneKindSignatures - ghc-options: -Wall -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude -Wno-missed-specializations -Wno-all-missed-specializations -Wno-missing-import-lists -Wno-type-defaults -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -optP-Wno-nonportable-include-path -fhide-source-paths -fno-show-valid-hole-fits -fno-sort-valid-hole-fits +RTS -N1 -RTS + ghc-options: -Wall -Weverything -Wno-safe -Wno-unsafe -Wno-implicit-prelude -Wno-missed-specializations -Wno-all-missed-specializations -Wno-missing-import-lists -Wno-type-defaults -Wno-missing-local-signatures -Wno-monomorphism-restriction -Wno-prepositive-qualified-module -Wno-missing-safe-haskell-mode -Wno-operator-whitespace -optP-Wno-nonportable-include-path -fhide-source-paths -fno-show-valid-hole-fits -fno-sort-valid-hole-fits +RTS -N1 -RTS cxx-options: -std=c++17 -D__EMBEDDED_SOUFFLE__ -std=c++17 -march=native include-dirs: cbits