Skip to content

Ghc 45102 #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
1 change: 1 addition & 0 deletions message-index/messages/GHC-45102/example1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/dist-newstyle/*
3 changes: 3 additions & 0 deletions message-index/messages/GHC-45102/example1/after/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages: fruits/
packages: vegatables/
packages: salad/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module Tomatoes where
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0

name: fruits
version: 0.0.1
license: MIT
author: Jappie
maintainer: [email protected]
build-type: Simple

library
exposed-modules: Tomatoes
build-depends: base
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{-# LANGUAGE PackageImports #-}

module Salad where

import "vegetables" Tomatoes
13 changes: 13 additions & 0 deletions message-index/messages/GHC-45102/example1/after/salad/salad.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0

name: salad
version: 0.0.1
license: MIT
author: Jappie
maintainer: [email protected]
build-type: Simple

library
exposed-modules: Salad
build-depends: base, fruits, vegetables
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module Tomatoes where
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0

name: vegetables
version: 0.0.1
license: MIT
author: Jappie
maintainer: [email protected]
build-type: Simple

library
exposed-modules: Tomatoes
build-depends: base
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages: fruits/
packages: vegatables/
packages: salad/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module Tomatoes where
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0

name: fruits
version: 0.0.1
license: MIT
author: Jappie
maintainer: [email protected]
build-type: Simple

library
exposed-modules: Tomatoes
build-depends: base
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Salad where

import Tomatoes
13 changes: 13 additions & 0 deletions message-index/messages/GHC-45102/example1/before/salad/salad.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0

name: salad
version: 0.0.1
license: MIT
author: Jappie
maintainer: [email protected]
build-type: Simple

library
exposed-modules: Salad
build-depends: base, fruits, vegetables
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module Tomatoes where
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cabal-version: 3.0

name: vegetables
version: 0.0.1
license: MIT
author: Jappie
maintainer: [email protected]
build-type: Simple

library
exposed-modules: Tomatoes
build-depends: base
default-language: Haskell2010
16 changes: 16 additions & 0 deletions message-index/messages/GHC-45102/example1/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Lambda syntax in `case` expression
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it related to GHC-45102? Seems like a rebase artifact.

---

When pattern matching with a `case` expression, backslash (`\`) is not required before the pattern.

## Error Message

```haskell
LambdaInCase.hs:6:5: error: [GHC-00482]
Lambda-syntax in pattern.
Pattern matching on functions is not possible.
|
6 | \a -> a
| ^^^^^^^
```
46 changes: 46 additions & 0 deletions message-index/messages/GHC-45102/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: Ambiguous module name from multiple packages
summary: A module with the same name was exported from multiple packages
severity: error
introduced: 9.6.1
---


When two packages export a module of the same name, ghc doesn't know which you
want to import.

The solution is to use package import.

So if we've two packages:

+ package fruits exports tomatoes:
```haskell
module Tomatoes where
```

+ and package vegetables exports tomatoes:

```haskell
module Tomatoes where
```

then our package salad program will cause an error:

```
module Salad where
import Tomatoes
```

The solution is to be specific with package imports:

```

{-# LANGUAGE PackageImports #-}

module Salad where

import "vegetables" Tomatoes
```

alternatively you could patch the upstream libraries,
but package imports is usually easiest.
Loading