Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build --noincompatible_use_python_toolchains
build --incompatible_use_python_toolchains
build --host_platform=@rules_haskell//haskell/platforms:linux_x86_64_nixpkgs
build --host_javabase='@local_jdk//:jdk'
2 changes: 1 addition & 1 deletion BUILD.nix.part
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ haskell_toolchain(
"-Wredundant-constraints",
],
tools = ["@ghc//:bin"],
version = "8.6.5",
version = "8.8.4",
is_static = False,
libraries = toolchain_libraries,
locale_archive = "@glibc_locales//:locale-archive",
Expand Down
24 changes: 12 additions & 12 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_sh",
sha256 = "63eb736f7562ed80054e373392abb0d4950d70e22542665079158854bd2cd98f",
strip_prefix = "rules_sh-39e356843071f93caf2caaf427d46cd10717501b",
urls = ["https://github.com/tweag/rules_sh/archive/39e356843071f93caf2caaf427d46cd10717501b.tar.gz"],
sha256 = "83a065ba6469135a35786eb741e17d50f360ca92ab2897857475ab17c0d29931",
strip_prefix = "rules_sh-0.2.0",
urls = ["https://github.com/tweag/rules_sh/archive/v0.2.0.tar.gz"],
)

load("@rules_sh//sh:repositories.bzl", "rules_sh_dependencies")
Expand All @@ -33,9 +33,9 @@ rules_sh_dependencies()
# NOTE: update release.nix if changing version of rules_haskell here.
http_archive(
name = "rules_haskell",
sha256 = "758f8190a9dd6e5e6fd7c9fb38a1bb4c5743a6e314d6678761e2cc070d8e465b",
strip_prefix = "rules_haskell-107ab5ccf0cdf884e19c1b3a37b9b8064c4e4e03",
urls = ["https://github.com/tweag/rules_haskell/archive/107ab5ccf0cdf884e19c1b3a37b9b8064c4e4e03.tar.gz"],
sha256 = "b4e2c00da9bc6668fa0404275fecfdb31beb700abdba0e029e74cacc388d94d6",
strip_prefix = "rules_haskell-0.13",
urls = ["https://github.com/tweag/rules_haskell/archive/v0.13.tar.gz"],
)

load("@rules_haskell//haskell:repositories.bzl", "rules_haskell_dependencies")
Expand All @@ -44,9 +44,9 @@ rules_haskell_dependencies()

http_archive(
name = "io_tweag_rules_nixpkgs",
sha256 = "f5af641e16fcff5b24f1a9ba5d93cab5ad26500271df59ede344f1a56fc3b17d",
strip_prefix = "rules_nixpkgs-0.6.0",
urls = ["https://github.com/tweag/rules_nixpkgs/archive/v0.6.0.tar.gz"],
sha256 = "5c80f5ed7b399a857dd04aa81e66efcb012906b268ce607aaf491d8d71f456c8",
strip_prefix = "rules_nixpkgs-0.7.0",
urls = ["https://github.com/tweag/rules_nixpkgs/archive/v0.7.0.tar.gz"],
)

### MARK: CUT START when building with nix
Expand Down Expand Up @@ -104,12 +104,12 @@ haskell_register_ghc_nixpkgs(
"//nix:versions.json",
],
repositories = {"nixpkgs": "@nixpkgs//nix:nixpkgs.nix"},
version = "8.6.5",
version = "8.8.4",
)

load("@rules_haskell//haskell:toolchain.bzl", "rules_haskell_toolchains")
#load("@rules_haskell//haskell:toolchain.bzl", "rules_haskell_toolchains")

rules_haskell_toolchains(version = "8.6.5")
#rules_haskell_toolchains(version = "8.8.4")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to remove those lines, otherwise it would not build... IIRC.


load(
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
Expand Down
2 changes: 2 additions & 0 deletions brittany.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
conf_layout:
lconfig_indentAmount: 4
8 changes: 4 additions & 4 deletions nix/versions.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"nixpkgs": {
"owner": "NixOS",
"repo": "nixpkgs-channels",
"branch": "nixos-unstable",
"rev": "a21c2fa3ea2b88e698db6fc151d9c7259ae14d96",
"sha256": "1z3kxlbz6bqx1dlagcazg04vhk67r8byihzf959c3m0laf2a1w7y"
"repo": "nixpkgs",
"branch": "nixos-20.09",
"rev": "d105075a1fd870b1d1617a6008cb38b443e65433",
"sha256": "1jcs44wn0s6mlf2jps25bvcai1rij9b2dil6zcj8zqwf2i8xmqjh"
},
"gitignore": {
"owner": "hercules-ci",
Expand Down
4 changes: 2 additions & 2 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ with {
rules_haskell = pkgs.fetchFromGitHub {
owner = "tweag";
repo = "rules_haskell";
rev = "107ab5ccf0cdf884e19c1b3a37b9b8064c4e4e03";
sha256 = "092cx9xix6r8735yn4j247kanzmsh1bjjifgk39jq8fidgldlhsj";
rev = "v0.13";
sha256 = "092cx9xix6r8735yn4j247kanzmsh1bjjifgk39jq8fidgldlhs0";
};
};
with {
Expand Down
18 changes: 1 addition & 17 deletions tooling.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,7 @@

let
pkgs = (import ./default.nix).pkgs;
haskellPackages = pkgs.haskellPackages.override (old: {
overrides =
with pkgs;
lib.composeExtensions (old.overrides or (_: _: {})) (self: super: {
# For brittany
multistate = haskell.lib.doJailbreak super.multistate;
# See https://github.com/NixOS/nixpkgs/issues/54534.
brittany = haskell.lib.doJailbreak (self.callCabal2nix "brittany"
(pkgs.fetchFromGitHub {
owner = "lspitzner";
repo = "brittany";
rev = "6c187da8f8166d595f36d6aaf419370283b3d1e9";
sha256 = "0nmnxprbwws3w1sh63p80qj09rkrgn9888g7iim5p8611qyhdgky";
}) {});
});
});
in with haskellPackages; [
in with pkgs.haskellPackages; [
ghcid

brittany
Expand Down
13 changes: 6 additions & 7 deletions treetide/haskell/extended/optparse-applicative/Extended.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ module Options.Applicative.Extended
where

import Data.ByteString ( ByteString )
import Data.Monoid ( (<>) )
import Data.Monoid ( )
import Data.Text ( Text )
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import Options.Applicative
import Options.Applicative.Builder.Internal
( HasName
, HasValue
)
( )

-- | Shorthand for defining a program help and executing the option parser.
parseOptionsIO :: Text -> Parser a -> IO a
Expand Down Expand Up @@ -46,9 +44,10 @@ class Optionable a where
-- complicated types manually. But preferrably complicated stuff should not be
-- passed as options.
instance (Show a, Read a, Num a) => Optionable a where
defineOption name defVal desc =
option auto (defOptionableMods name (defVal + 0 {- to force constraint -}
) desc show)
defineOption name defVal desc = option
auto
(defOptionableMods name (defVal + 0 {- to force constraint -}
) desc show)

instance {-# OVERLAPPING #-} Optionable Text where
defineOption name defVal desc =
Expand Down
19 changes: 9 additions & 10 deletions treetide/haskell/extended/xml-conduit/XmlConduit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ import Conduit ( ConduitT
, yield
, MonadThrow
)
import Control.Monad ( join
, void
)
import Data.Function ( on )
import Data.Text ( Text
, toCaseFold
import Control.Monad ( -- join
-- , void
)
import Data.Text ( toCaseFold )
import Data.XML.Types ( Event )
import qualified Text.XML as XML
( Name(..) )
Expand Down Expand Up @@ -60,17 +57,19 @@ matchingLocalName localName = XML.matching isTagWithLocalName
-- | Skip tag with a given name. No-op if next tag to parse does not match.
ignoreTagTree :: MonadThrow m => Text -> ConduitT Event o m ()
ignoreTagTree tagName =
void (XML.ignoreTreeContent $ matchingLocalName tagName)
void (XML.ignoreTreeContent (matchingLocalName tagName) ignoreAttrs)

-- | Skip tags in sequence. Only tags in given order are skipped.
ignoreTagSequence :: MonadThrow m => [Text] -> ConduitT Event o m ()
ignoreTagSequence =
mapM_ $ XML.many_ . XML.ignoreTreeContent . matchingLocalName
mapM_
$ XML.many_
. (\name -> XML.ignoreTreeContent (matchingLocalName name) ignoreAttrs)

-- | Skip tags which are not on the list.
ignoreTagsExcept :: MonadThrow m => [Text] -> ConduitT Event o m ()
ignoreTagsExcept tagsToKeep = XML.many_
$ XML.ignoreTreeContent (XML.matching $ not . isTagToKeep)
$ XML.ignoreTreeContent (XML.matching $ not . isTagToKeep) ignoreAttrs
where
isTagToKeep :: XML.Name -> Bool
isTagToKeep t =
Expand Down Expand Up @@ -126,7 +125,7 @@ parseFoldState parsers0 s0 = Just <$> go s0
parsers = parsers0 <> [parseFallback]
where
-- Swallows an unhandled tag.
parseFallback s = fmap (fmap (const s)) XML.ignoreAnyTreeContent
parseFallback s = fmap (fmap (const s)) XML.ignoreAnyTreeContent
-- | Tries the first subparser that works (falling back to an accept-any
-- parser), and loops while there's any tag to try.
go s = do
Expand Down