Skip to content
Merged
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ghc: [ghc984, ghc9101, ghc9121]
ghc: [ghc9102, ghc9122, ghc9141]
name: Build and test on ${{ matrix.ghc }}
runs-on: ubuntu-latest
steps:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
* Fixed printing of guards on pattern binds. [Issue
1178](https://github.com/tweag/ormolu/issues/1178).

* Switched to `ghc-lib-parser-9.14`, with the following new syntactic features:
* GHC proposal [#493](https://github.com/ghc-proposals/ghc-proposals/blob/e2c683698323cec3e33625369ae2b5f585387c70/proposals/0493-specialise-expressions.rst): expressions in SPECIALISE pragmas
* Multiline strings in foreign import declarations.
* `ExplicitNamespaces` supports the `data` namespace specifier in import and export lists, replacing `pattern`.
* `LinearTypes` adds new syntax to support non-linear record fields.
* `RequiredTypeArguments` allows visible forall in GADT syntax.

* Updated to `Cabal-syntax-3.16`.

* Correctly format string literals containing the `\^\` escape sequence. [Issue
1165](https://github.com/tweag/ormolu/issues/1165).

## Ormolu 0.8.0.2

* Fixed a performance regression introduced in 0.8.0.0. [Issue
Expand Down
6 changes: 5 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
packages: . extract-hackage-info

index-state: 2025-01-16T23:07:37Z
index-state: 2026-02-17T00:12:25Z

tests: True
multi-repl: True

constraints: ormolu +dev

allow-newer:
*:template-haskell,
*:base,
11 changes: 11 additions & 0 deletions data/examples/declaration/data/linear-out.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{-# LANGUAGE LinearTypes #-}

data Record = Rec {x %'Many :: Int, y :: Char}

data T2 a b c where
MkT2 :: a -> b %1 -> c %1 -> T2 a b c

data T2 a b c = MkT2 {x %Many :: a, y :: b, z :: c}

data T3 a m where
MkT3 :: a %m -> T3 a m
10 changes: 10 additions & 0 deletions data/examples/declaration/data/linear.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{-# LANGUAGE LinearTypes #-}
data Record = Rec { x %'Many :: Int, y :: Char }

data T2 a b c where
MkT2 :: a -> b %1 -> c %1 -> T2 a b c

data T2 a b c = MkT2 { x %Many :: a, y :: b, z :: c }

data T3 a m where
MkT3 :: a %m -> T3 a m
27 changes: 27 additions & 0 deletions data/examples/declaration/data/required-type-arguments-out.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
data T a where
Typed :: forall a -> a -> T a

f1 (Typed a x) = x :: a

f2 (Typed Int n) = n * 2

f3 (Typed ((->) w Bool) g) = not . g

data D x where
MkD1 ::
forall a b ->
a ->
b ->
D (a, b)
MkD2 ::
forall a.
forall b ->
a ->
b ->
D (a, b)
MkD3 ::
forall a ->
a ->
forall b ->
b ->
D (a, b)
24 changes: 24 additions & 0 deletions data/examples/declaration/data/required-type-arguments.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
data T a where
Typed :: forall a -> a -> T a

f1 (Typed a x) = x :: a
f2 (Typed Int n) = n*2
f3 (Typed ((->) w Bool) g) = not . g

data D x where
MkD1 :: forall a b ->
a ->
b ->
D (a, b)

MkD2 :: forall a.
forall b ->
a ->
b ->
D (a, b)

MkD3 :: forall a ->
a ->
forall b ->
b ->
D (a, b)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{-# LANGUAGE MultilineStrings #-}

foreign import capi
"""
foo
bar
"""
foo :: Int -> Int
6 changes: 6 additions & 0 deletions data/examples/declaration/foreign/foreign-import-multiline.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{-# language MultilineStrings #-}

foreign import capi """
foo
bar
""" foo :: Int -> Int
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{-# SPECIALIZE addMult @Double #-}
{-# SPECIALIZE addMult (5 :: Int) #-}
{-# SPECIALIZE addMult 5 :: Int -> Int #-}

{-# SPECIALIZE [1] forall x y. f @Int True (x, y) #-}

{-# SPECIALIZE forall x xs. loop (x : xs)
#-}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{-# SPECIALISE addMult @Double #-}
{-# SPECIALISE addMult (5 :: Int) #-}
{-# SPECIALISE addMult 5 :: Int -> Int #-}

{-# SPECIALISE [1] forall x y. f @Int True (x,y) #-}

{-# SPECIALISE
forall x xs .
loop (x:xs) #-}
10 changes: 10 additions & 0 deletions data/examples/declaration/signature/specialize/specialize-3-out.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sep, fsep, hsep :: (Applicative m, Foldable t) => t (m Doc) -> m Doc
sep = fmap P.sep . sequenceAFoldable
{-# SPECIALIZE NOINLINE sep :: [TCM Doc] -> TCM Doc #-}
{-# SPECIALIZE NOINLINE sep :: List1 (TCM Doc) -> TCM Doc #-}
fsep = fmap P.fsep . sequenceAFoldable
{-# SPECIALIZE NOINLINE [2] fsep :: [TCM Doc] -> TCM Doc #-}
{-# SPECIALIZE NOINLINE [2] fsep :: List1 (TCM Doc) -> TCM Doc #-}
hsep = fmap P.hsep . sequenceAFoldable
{-# SPECIALIZE NOINLINE [~2] hsep :: [TCM Doc] -> TCM Doc #-}
{-# SPECIALIZE NOINLINE [~2] hsep :: List1 (TCM Doc) -> TCM Doc #-}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sep, fsep, hsep :: (Applicative m, Foldable t) => t (m Doc) -> m Doc
sep = fmap P.sep . sequenceAFoldable ; {-# SPECIALIZE NOINLINE sep :: [TCM Doc] -> TCM Doc #-} ; {-# SPECIALIZE NOINLINE sep :: List1 (TCM Doc) -> TCM Doc #-}
fsep = fmap P.fsep . sequenceAFoldable ; {-# SPECIALIZE NOINLINE [2] fsep :: [TCM Doc] -> TCM Doc #-} ; {-# SPECIALIZE NOINLINE [2] fsep :: List1 (TCM Doc) -> TCM Doc #-}
hsep = fmap P.hsep . sequenceAFoldable ; {-# SPECIALIZE NOINLINE [~2] hsep :: [TCM Doc] -> TCM Doc #-} ; {-# SPECIALIZE NOINLINE [~2] hsep :: List1 (TCM Doc) -> TCM Doc #-}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{-# LANGUAGE LinearTypes #-}

h x = g y
where
%1 y = f x

let %1 x = u in ()
let %Many (x, y) = u in ()
let %1 ~(x, y) = u in ()
9 changes: 9 additions & 0 deletions data/examples/declaration/value/function/linear-bindings.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{-# Language LinearTypes #-}

h x = g y
where
%1 y = f x

let %1 x = u in ()
let %Many (x, y) = u in ()
let %1 ~(x, y) = u in ()
2 changes: 2 additions & 0 deletions data/examples/declaration/value/function/strings-out.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ baz =
\baz"

weirdGap = "\65\ \0"

weirdEscape = "\^\ "
2 changes: 2 additions & 0 deletions data/examples/declaration/value/function/strings.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ baz = "foo\
\baz"

weirdGap = "\65\ \0"

weirdEscape = "\^\ "
3 changes: 3 additions & 0 deletions data/examples/import/data-out.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Bar (data P, T (data P), data f) where

import N (T (data P), data P, data f)
6 changes: 6 additions & 0 deletions data/examples/import/data.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

module Bar (data P, T(data P), data f) where

import N (data P)
import N (T(data P))
import N (data f)
2 changes: 1 addition & 1 deletion data/examples/other/empty-forall-out.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type family T x where
forall. T x = x

{-# RULES
"r"
"r" forall.
r a =
()
#-}
6 changes: 2 additions & 4 deletions expected-failures/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ let
inherit (pkgs) lib;
expectedFailures = [
"brittany"
"esqueleto"
"hlint"
"leksah"
"lens"
Expand Down Expand Up @@ -52,7 +51,6 @@ in
"distributed-process"
"esqueleto"
"fay"
"graphql-engine"
"hakyll"
"haxl"
"hedgehog"
Expand All @@ -75,11 +73,11 @@ in
"servant-server"
"stack"
"tensorflow"
"text_2_0_2"
"text_2_1_3"
"tls"
"unpacked-containers"
"yesod-core"
];
in
pkgs.recurseIntoAttrs (lib.genAttrs ps (p: (ormolizedPackages true).${p}));
pkgs.lib.recurseIntoAttrs (lib.genAttrs ps (p: (ormolizedPackages true).${p}));
}
3 changes: 0 additions & 3 deletions expected-failures/esqueleto.txt

This file was deleted.

6 changes: 3 additions & 3 deletions expected-failures/hlint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ src/Extension.hs
Please, consider reporting the bug.
src/Hint/Bracket.hs
@@ -294,8 +294,11 @@
let y = noLocA $ HsApp EpAnnNotUsed a1 (nlHsPar a2),
let y = noLocA $ HsApp noExtField a1 (nlHsPar a2),
let r = Replace Expr (toSSA e) [("a", toSSA a1), ("b", toSSA a2)] "a (b)"
]
- ++ [ (suggest "Redundant bracket" (reLoc x) (reLoc y) [r]) {ideaSpan -- Special case of (v1 . v2) <$> v3
Expand All @@ -24,9 +24,9 @@ src/Hint/Bracket.hs
+ =
+ locA locPar
+ }
| L _ (OpApp _ (L locPar (HsPar _ _ o1@(L locNoPar (OpApp _ _ (isDot -> True) _)) _)) o2 v3) <- [x],
| L _ (OpApp _ (L locPar (HsPar _ o1@(L locNoPar (OpApp _ _ (isDot -> True) _)))) o2 v3) <- [x],
varToStr o2 == "<$>",
let y = noLocA (OpApp EpAnnNotUsed o1 o2 v3) :: LHsExpr GhcPs,
let y = noLocA (OpApp noExtField o1 o2 v3) :: LHsExpr GhcPs,

Formatting is not idempotent.
Please, consider reporting the bug.
5 changes: 3 additions & 2 deletions expected-failures/pandoc.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
src/Text/Pandoc/ImageSize.hs
@@ -131,6 +131,7 @@
@@ -135,7 +135,8 @@
"\x01\x00\x00\x00"
| B.take 4 (B.drop 40 img) == " EMF" ->
return Emf
- "\xEF\xBB\xBF<" -> -- BOM before svg
+ "\xEF\xBB\xBF<" ->
+ -- BOM before svg
imageType (B.drop 3 img)
_ -> mzero
"RIFF"
| B.take 4 (B.drop 8 img) == "WEBP" ->

Formatting is not idempotent.
Please, consider reporting the bug.
Expand Down
2 changes: 1 addition & 1 deletion expected-failures/postgrest.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
src/PostgREST/Plan.hs
@@ -596,13 +596,12 @@
@@ -676,13 +676,12 @@
&& (
-- /projects?select=clients!projects_client_id_fkey(*)
matchConstraint hnt relCardinality
Expand Down
6 changes: 3 additions & 3 deletions extract-hackage-info/extract-hackage-info.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ executable extract-hackage-info
-Wunused-packages

build-depends:
Cabal-syntax >=3.14 && <3.15,
Cabal-syntax >=3.16 && <3.17,
aeson >=2.2 && <3,
base >=4.12 && <5,
binary >=0.8 && <0.9,
bytestring >=0.10 && <0.13,
containers >=0.6 && <0.8,
containers >=0.6 && <0.9,
directory >=1 && <2,
filepath >=1.2 && <1.6,
formatting >=7.1 && <7.3,
megaparsec >=9,
optparse-applicative >=0.14 && <0.19,
optparse-applicative >=0.14 && <0.20,
ormolu,
text >=2.1 && <3,
Loading