-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Add sig lens for where clauses #2966
base: master
Are you sure you want to change the base?
Changes from 3 commits
ba2d544
7bf07ca
51ef231
cd34e8c
c9daf86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Infix where | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
g :: p1 -> p -> p1 | ||
a `g` b = a |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Infix where | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
a `g` b = a |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Inline where | ||
|
||
f :: a | ||
f = undefined | ||
where g :: Bool | ||
g = True |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Inline where | ||
|
||
f :: a | ||
f = undefined | ||
where g = True |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Nest where | ||
|
||
f :: Int | ||
f = g | ||
where | ||
g :: Int | ||
g = h | ||
h :: Int | ||
h = k where k :: Int | ||
k = 3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Nest where | ||
|
||
f :: Int | ||
f = g | ||
where | ||
g = h | ||
h = k where k = 3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module NoLens where | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
g = 3 | ||
|
||
|
||
|
||
|
||
|
||
|
||
g :: Int |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module NoLens where | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
g = 3 | ||
|
||
|
||
|
||
|
||
|
||
|
||
g :: Int |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Operator where | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
g :: (a -> b) -> a -> b | ||
g = ($) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Operator where | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
g = ($) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Qualified where | ||
|
||
import qualified Data.Map as Map | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
g :: Map.Map Bool Char | ||
g = Map.singleton True 'c' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Qualified where | ||
|
||
import qualified Data.Map as Map | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
g = Map.singleton True 'c' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{-# LANGUAGE ExplicitForAll #-} | ||
module ScopedTypeVariables where | ||
|
||
f :: forall a b. a -> b -> (a, b) | ||
f aa bb = (aa, ida bb) | ||
where | ||
ida :: b -> b | ||
ida = id | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{-# LANGUAGE ExplicitForAll #-} | ||
module ScopedTypeVariables where | ||
|
||
f :: forall a b. a -> b -> (a, b) | ||
f aa bb = (aa, ida bb) | ||
where | ||
ida = id |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Simple where | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
g :: Bool | ||
g = True |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Simple where | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
g = True |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Typle where | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
g :: Integer | ||
h :: Bool | ||
(g, h) = (1, True) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Typle where | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
(g, h) = (1, True) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Typeclass where | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
g :: Num a => a -> a -> a | ||
g a b = a + b | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you saying that the lens cannot deduce There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for ignoring this...
Yes.
But it's not correct without constraints. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Typeclass where | ||
|
||
f :: a | ||
f = undefined | ||
where | ||
g a b = a + b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It fails as you may guess...