On 05/04/15 15:54, Daniel Trstenjak wrote:
On Sun, Apr 05, 2015 at 03:25:01PM +0300, Roman Cheplyaka wrote:
Data.ByteString.Lazy.Char8 exports the same lazy bytestring type as
Data.ByteString.Lazy. Only functions and instances differ.
So my only option in this case is to define a newtype
Hi,
I'm getting the compile error:
Gamgine/Image/PNG/Internal/Parser.hs:14:10:
Functional dependencies conflict between instance declarations:
instance Monad m = Stream LB.ByteString m Word8
-- Defined at Gamgine/Image/PNG/Internal/Parser.hs:14:10
instance Monad m
the same lazy bytestring type as
Data.ByteString.Lazy. Only functions and instances differ.
Well, *instances* can't differ...
On 05/04/15 15:19, Daniel Trstenjak wrote:
Hi,
I'm getting the compile error:
Gamgine/Image/PNG/Internal/Parser.hs:14:10:
Functional dependencies conflict
Data.ByteString.Lazy.Char8 exports the same lazy bytestring type as
Data.ByteString.Lazy. Only functions and instances differ.
On 05/04/15 15:19, Daniel Trstenjak wrote:
Hi,
I'm getting the compile error:
Gamgine/Image/PNG/Internal/Parser.hs:14:10:
Functional dependencies conflict
On Sun, Apr 05, 2015 at 03:25:01PM +0300, Roman Cheplyaka wrote:
Data.ByteString.Lazy.Char8 exports the same lazy bytestring type as
Data.ByteString.Lazy. Only functions and instances differ.
So my only option in this case is to define a newtype wrapper
for Data.ByteString.Lazy and then define
Hello,
Maybe this is well known already (or maybe it's a bug), but lately I've
again found that functional
dependencies are more versatile than type families. In particular, they can
be used to compute
kinds from types, whereas type families cannot. Consider the code below,
which implements
?...
Yes, I ran into this a while ago. A function dependency on a kind seems to work
remarkably well.
Can we have type families that return kinds? No. Well, not yet. Functional
dependencies inform type inference but don't produce any evidence in Core -- a
dependency is only ever used to eliminate
understand thisI can't claim that Bar,x is a
member of Foo and Integer,Integer is member of Foo and preserve my functional
dependencies, because Bar,Integer is now a member of Foo..
Bad programmer...
So how I naively go
class NotAnInteger a
instance (NotAnInteger x) = Foo Bar x
Error!but I’m think I understand this….I can’t claim that Bar,x is a
member of Foo and Integer,Integer is member of Foo and preserve my
functional dependencies, because Bar,Integer is now a member of Foo..
Bad programmer…….
So how I naively go….
class NotAnInteger
functional dependencies, because Bar,Integer is now a member of Foo..***
*
** **
Bad programmer…….
** **
** **
So how I naively go….
** **
** **
class NotAnInteger a
** **
instance (NotAnInteger x) = Foo Bar x
** **
I haven’t declared integer to be “NotAnInteger
Functional dependencies
conflict between instance declarations:.
You're running into the open worldassumption--anybody could come along and
make Integer part of your NotAnInteger class, and there's nothing you can do to
stop them. This is a design tradeoff for typeclasses: typeclass instances
that s will be
always deducible from m.
I wonder, would it be possible to augment the type checker to realize this?
It seems reasonable: Before comparing if S(tvsright) is a subset of
S(tvsleft), we'd add every type variable to S(tvsleft) that is determined
from it using functional dependencies
Dear Haskellers,
I'm working on a small library for representing semigroup (or monoid)
actions on a set http://hackage.haskell.org/package/semigroups-actions.
The MultiParamTypeClasses extension seems to be best suited for the task,
as a group can act on many sets, and a set can be acted on by
Petr,
Your subject header is misleading: FDs don't make sense without MPTCs.
As you acknowledge at the end, what you're ultimately asking is: to FD or
not to FD.
Note also, the contemporary debate has shifted to TFs (type families) vs
FDs.
-- Kim-Ee
On Fri, Dec 21, 2012 at 7:38 PM, Petr P
Hi Kim-Ee,
you're right, it's a bit misleading.
I thought about TFs too, personally I mostly prefer them over FDs, but I'd
like the library available for as many compilers as possible. 'semigroups'
is just Haskell 98 and I'd like to keep the requirements similarly low.
Best regards,
Petr
* Petr P petr@gmail.com [2012-12-21 13:38:21+0100]
Dear Haskellers,
I'm working on a small library for representing semigroup (or monoid)
actions on a set http://hackage.haskell.org/package/semigroups-actions.
The MultiParamTypeClasses extension seems to be best suited for the task,
as
#7384: Panic ctEvTerm when using functional dependencies and PolyKinds
-+--
Reporter: goldfire| Owner:
Type: bug
#7384: Panic ctEvTerm when using functional dependencies and PolyKinds
--+-
Reporter: goldfire | Owner:
Type: bug | Status: new
#7384: Panic ctEvTerm when using functional dependencies and PolyKinds
--+-
Reporter: goldfire | Owner:
Type: bug | Status: new
#7384: Panic ctEvTerm when using functional dependencies and PolyKinds
-+--
Reporter: goldfire | Owner:
Type: bug
#7384: Panic ctEvTerm when using functional dependencies and PolyKinds
--+-
Reporter: goldfire | Owner:
Type: bug | Status: new
Consider the code below :
{-# LANGUAGE
MultiParamTypeClasses,FlexibleInstances,FunctionalDependencies,UndecidableInstances,FlexibleContexts
#-}
class Foo a c | a - c
instance Foo Int Float
f :: (Foo Int a) = Int - a
f = undefined
Now when I see the inferred type of f in ghci
:t f
f :: Int -
I don't know if this is a bug or not, but the translation to type
families works:
class Foo a where
type FooT a :: *
instance Foo Int where
type FooT Int = Float
f :: Int - FooT Int
f = undefined
g :: Int - Float
g = undefined
h :: Int - FooT Int
h = g
You don't even need the class
Copying the mailing list, because I forgot.
On Thu, Sep 13, 2012 at 5:18 AM, satvik chauhan mystic.sat...@gmail.com wrote:
Consider the code below :
{-# LANGUAGE
MultiParamTypeClasses,FlexibleInstances,FunctionalDependencies,UndecidableInstances,FlexibleContexts
#-}
class Foo a c | a - c
: converting functional dependencies to type families
|
|
| On Thu, 7 Jun 2012, Simon Peyton-Jones wrote:
|
| Very useful! Maybe worth turning into a page on the Haskell wiki?
|
| I created one:
|
| http://www.haskell.org/haskellwiki/Functional_dependencies_vs._type_fami
| lies
On Mon, 11 Jun 2012, Simon Peyton-Jones wrote:
Thanks. I've linked to it from
http://www.haskell.org/haskellwiki/GHC/Type_families#Frequently_asked_questions
Thank you! I already added this and another link to a new See also
section below. Which one shall we maintain?
On Thu, 7 Jun 2012, Simon Peyton-Jones wrote:
Very useful! Maybe worth turning into a page on the Haskell wiki?
I created one:
http://www.haskell.org/haskellwiki/Functional_dependencies_vs._type_families
___
Haskell-Cafe mailing list
#6134: Incorrect ambiguity error with functional dependencies
-+--
Reporter: diatchki| Owner:
Type: bug | Status: closed
#6134: Incorrect ambiguity error with functional dependencies
+---
Reporter: diatchki | Owner:
Type: bug | Status: new
Hi all,
when I reported a typechecker performance problem related to functional
dependencies
http://hackage.haskell.org/trac/ghc/ticket/5970
I promised to try to convert from functional dependencies to type
families.
Thus I converted my code and the llvm package to type-families
#6134: Incorrect ambiguity error with functional dependencies
---+
Reporter: diatchki | Owner:
Type: bug| Status: new
#6068: Panic in GHCi when using functional dependencies and promoted kinds
--+-
Reporter: goldfire | Owner:
Type: bug | Status: new
Priority
#6068: Panic in GHCi when using functional dependencies and promoted kinds
--+-
Reporter: goldfire | Owner:
Type: bug | Status: new
Priority
#3108: Do a better job of solving recursive type-class constraints with
functional
dependencies
+---
Reporter: simonpj | Owner:
Type: bug
#3108: Do a better job of solving recursive type-class constraints with
functional
dependencies
+---
Reporter: simonpj| Owner:
Type: bug
#3108: Do a better job of solving recursive type-class constraints with
functional
dependencies
+---
Reporter: simonpj | Owner:
Type: bug
#3108: Do a better job of solving recursive type-class constraints with
functional
dependencies
+---
Reporter: simonpj | Owner:
Type: bug
#5736: Possible regression with functional dependencies
--+-
Reporter: magnus | Owner:
Type: bug | Status: closed
Priority
#5736: Possible regression with functional dependencies
--+-
Reporter: magnus| Owner:
Type: bug | Status: new
Priority: normal
#5736: Possible regression with functional dependencies
--+-
Reporter: magnus | Owner:
Type: bug | Status: closed
Priority
#5236: Circular functional dependencies cause loop in typechecker
--+-
Reporter: dimitris | Owner:
Type: bug | Status: closed
#5236: Circular functional dependencies cause loop in typechecker
-+--
Reporter: dimitris | Owner:
Type: bug | Status: new
Hi Oscar,
Sorry for the seriously late reply. I only just found this message in
the bottom of my inbox:
On an unrelated note:
I hoogled to (i.e. http://haskell.org/hoogle/?hoogle=to) and just
got a blank page. Nothing. Nil (not even html.../html). Is this a
bug or a feature? :)
It was a
Of JP Moresmau
Sent: 16 March 2011 21:46
To: Haskell Cafe
Subject: [Haskell-cafe] Could not deduce ... using functional dependencies with
GHC7
Hello, when moving to GHC7 a body of code that I'm not immensely familiar with,
I got an error compiling with GHC 7.0.2. Can somebody kindly explain to me
[mailto:haskell-cafe-boun...@haskell.org] On Behalf Of JP Moresmau
Sent: 16 March 2011 21:46
To: Haskell Cafe
Subject: [Haskell-cafe] Could not deduce ... using functional dependencies
with GHC7
Hello, when moving to GHC7 a body of code that I'm not immensely familiar
with, I got an error
On Fri, Mar 18, 2011 at 13:35, JP Moresmau wrote:
These are GHC types, but here is a self-contained example:
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
FlexibleInstances #-}
data Id=Id String
data Result id =ResultId Id
| ResultGen id
data Sig id=IdSig Id
|
On Friday 18 March 2011 13:35:22, JP Moresmau wrote:
These are GHC types, but here is a self-contained example:
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
FlexibleInstances #-}
data Id=Id String
data Result id =ResultId Id
| ResultGen id
data Sig id=IdSig Id
Thanks to you all, I think I understand better.
instance Search Id Id where
search _ _ i = only (FoundId i)
Is too restrictive on the first type, so declaring instead:
instance Search id Id where
search _ _ i = only (FoundId i)
Fixed the issue!! Now the initial id is not Id and everybody is
On Friday 18 March 2011 14:40:40, JP Moresmau wrote:
Thanks to you all, I think I understand better.
instance Search Id Id where
search _ _ i = only (FoundId i)
Is too restrictive on the first type, so declaring instead:
instance Search id Id where
search _ _ i = only (FoundId i)
Not
Hi,
that's a bug in GHC---it erroneously accepts polymorphic instances which
violate the FD of a class.
-Iavor
On Fri, Mar 18, 2011 at 7:08 AM, Daniel Fischer
daniel.is.fisc...@googlemail.com wrote:
On Friday 18 March 2011 14:40:40, JP Moresmau wrote:
Thanks to you all, I think I understand
by
the instance declaration at lib\Scion\Inspect\Find.hs:477:18
When using functional dependencies to combine
Search Id Id,
arising from the dependency `a - id'
in the instance declaration at lib\Scion\Inspect\Find.hs:183:10
Search id Id,
arising from a use of `search
#4401: Functional dependencies regression
---+
Reporter: rl| Owner: simonpj
Type: bug | Status: closed
Priority: highest | Milestone: 7.0.1
#4401: Functional dependencies regression
---+
Reporter: rl| Owner: simonpj
Type: bug | Status: merge
Priority: highest | Milestone: 7.0.1
#4401: Functional dependencies regression
---+
Reporter: rl| Owner: simonpj
Type: bug | Status: closed
Priority: highest | Milestone: 7.0.1
#4418: Superclass functional dependencies are ignored during instance selection
-+--
Reporter: reinerp | Owner:
Type: bug
#4401: Functional dependencies regression
---+
Reporter: rl| Owner: simonpj
Type: bug | Status: closed
Priority: highest | Milestone: 7.0.1
#4401: Functional dependencies regression
---+
Reporter: rl| Owner: simonpj
Type: bug | Status: closed
Priority: highest | Milestone: 7.0.1
#4418: Superclass functional dependencies are ignored during instance selection
+---
Reporter: reinerp |Owner:
Type: bug
#4418: Superclass functional dependencies are ignored during instance selection
+---
Reporter: reinerp |Owner:
Type: bug
#4401: Functional dependencies regression
---+
Reporter: rl| Owner: simonpj
Type: bug | Status: closed
Priority: highest | Milestone: 7.0.1
#4418: Superclass functional dependencies are ignored during instance selection
-+--
Reporter: reinerp | Owner:
Type: bug | Status: new
#4401: Functional dependencies regression
-+--
Reporter: rl|Owner: simonpj
Type: bug | Status: new
Priority: highest |Milestone
#4401: Functional dependencies regression
-+--
Reporter: rl| Owner:
Type: bug | Status: new
Priority: normal| Component
#4401: Functional dependencies regression
-+--
Reporter: rl|Owner: simonpj
Type: bug | Status: new
Priority: highest |Milestone
#2296: Functional dependencies error message has no position information
---+
Reporter: NeilMitchell | Owner: simonpj
Type: bug | Status: closed
Priority: high
#2296: Functional dependencies error message has no position information
-+--
Reporter: NeilMitchell |Owner: simonpj
Type: bug | Status: new
Priority: high
#2296: Functional dependencies error message has no position information
-+--
Reporter: NeilMitchell |Owner:
Type: bug | Status: new
Priority: high
Thanks for the great feedback. The bijective example was especially interesting.
While reading Fun with Type Functions I notices GNum as an
interesting alternative to the Num type class but I couldn't find any
such package on hackagedb. Do anyone know if there is anything like
GNum on hackagedb?
Oscar Finnsson wrote:
Anyone made a module/package that solves this problem already? I
cannot be the first that needs generic type safe conversion... .
There's a restricted version in logfloat:Data.Numer.RealToFrac[1] which
generalizes the Prelude's realToFrac to improve performance and
On Sun, Jul 11, 2010 at 12:43:47AM +0200, Jose A. Ortega Ruiz wrote:
On Sat, Jul 10 2010, wren ng thornton wrote:
[...]
Yes, you can add multiple dependencies. The syntax is to use , after
the first |.
While having eight parameters is surely a desperate need for
refactoring,
On Sat, Jul 10 2010, wren ng thornton wrote:
[...]
Yes, you can add multiple dependencies. The syntax is to use , after
the first |.
While having eight parameters is surely a desperate need for
refactoring, there are times when you'd want multiple dependencies.
For example, you can say
Brandon S Allbery KF8NH wrote:
On 7/6/10 15:37 , Oscar Finnsson wrote:
but can they also be on a form similar to
a b c d e f g h| b c - d e f | b d g - h
(i.e. d,e,f are decided by the b,c-combination while h is decided by
the b,d,g-combination)?
I think the answer to this is yes, but if
Hi,
there is a lot of buzz around functional dependencies on the mailing
list and Planet Haskell. I've read some of the tutorials and I think I
understand how they work but I still haven't figured out where they
can be useful.
* Can someone give me a real world (preferably hackagedb) example
, so it's possible some of the
comments are slightly off :/
It uses type families instead of functional dependencies.
Anecdotally, my experience has been that functional dependencies are
much faster. You might find that it takes ghci a good deal of time to
load this file; type checking
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 7/6/10 15:37 , Oscar Finnsson wrote:
but can they also be on a form similar to
a b c d e f g h| b c - d e f | b d g - h
(i.e. d,e,f are decided by the b,c-combination while h is decided by
the b,d,g-combination)?
I think the answer to
Hi,
My understanding of functional dependencies is that they can be used to
ensure that one type depends on another type.
For example, the type of location depends could on the type of the
object at that location.
Consider two models
1) The location of an aircraft landing should have location
On 01/07/10 12:37, Patrick Browne wrote:
Why do some cases such as 1) fail to run even if they are the only
instantiation.
-- 1) Compiles but does not run
instance LocatedAt Int String where
spatialLocation(1)=home
That instance is fine. I presume the problem is that you are trying
Neil,
Does the following sum up the situation?
The class Num has subclasses containing various numeric types and the
literal 1 is a value for one or more of those types.
Hence the Haskell compiler says the instance 1) is OK.
But at run time, without the quantified (1:Int), the 1 could of more
than
Patrick Browne patrick.bro...@dit.ie writes:
Why do some cases such as 1) fail to run even if they are the only
instantiation.
I think this is because literal numbers are polymorphic, i.e. a '1' in
your source code is shorthand for 'fromIntegral 1', which is a type of
Num a = a. Thus,
The class Num has subclasses containing various numeric types and the
literal 1 is a value for one or more of those types.
Well, the problem is not with subclasses, but with types.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
this is at compile-time, not run-time. The problem comes down to
needing to know a specific type in order to pick a type-class instance
-- the functional dependencies are actually irrelevant to this aspect.
Let's say I have this simpler class:
class Big a where
isBig :: a - Bool
instance Big Int
#2296: Functional dependencies error message has no position information
-+--
Reporter: NeilMitchell |Owner:
Type: bug | Status: new
Priority: high
#2296: Functional dependencies error message has no position information
-+--
Reporter: NeilMitchell |Owner:
Type: bug | Status: new
Priority: high
2010/5/18 Tomáš Janoušek t...@nomi.cz:
Hello all,
for the past few hours I've been struggling to express a certain idea using
type families and I really can't get it to typecheck. It all works fine using
functional dependencies, but it could be more readable with TFs. From those
papers
think I'll just stay with functional
dependencies this time, a data type with wrapping and unwrapping can't
possibly make the code more readable :-).
Regards,
--
Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/
___
Haskell-Cafe mailing list
Haskell
Hello all,
for the past few hours I've been struggling to express a certain idea using
type families and I really can't get it to typecheck. It all works fine using
functional dependencies, but it could be more readable with TFs. From those
papers about TFs I got this feeling that they should
using
type families and I really can't get it to typecheck. It all works fine using
functional dependencies, but it could be more readable with TFs. From those
papers about TFs I got this feeling that they should be as expressive as FDs,
and we should use them (some people even occasionally mentioning
On Apr 30, 6:18 pm, John Creighton johns2...@gmail.com wrote:
On Apr 29, 7:47 am, John Creighton johns2...@gmail.com wrote:
I've been trying to apply some stuff I learned about functional
dependencies, but I run into one of two problems. I either end up with
inconsistent dependencies
On Apr 29, 7:47 am, John Creighton johns2...@gmail.com wrote:
I've been trying to apply some stuff I learned about functional
dependencies, but I run into one of two problems. I either end up with
inconsistent dependencies (OverlappingInstances doesn't seem to
apply) or I end up
I've been trying to apply some stuff I learned about functional
dependencies, but I run into one of two problems. I either end up with
inconsistent dependencies (OverlappingInstances doesn't seem to
apply) or I end up with infinite recursion. I want to be able to do
simple things like
It seems like a reasonable and not-too-painful solution, thanks!
Concerning Haskell typesystem, I know it to be beautiful, but also kind of
complex. One of the great Haskell assets is genericity, but this complexity
sometimes encumbers this genericity.
But still, Haskell is -- in terms of
There must be some kind of a private joke I don't get...
BTW, all you've said is pretty scaring...
It's strange I can't declare a generic instance for Binary types... I
thought I was trying to do something quite common in Haskell.
Apparently I'm still a young padawan with many things to learn.
On Apr 18, 2010, at 11:01 AM, Limestraël wrote:
It's strange I can't declare a generic instance for Binary types...
I thought I was trying to do something quite common in Haskell.
A common workaround is to define a newtype like this
newtype GenericBinary a = GB { fromGB :: a }
and an
of the type class
system--namely, the awkwardness of functional dependencies.
Unfortunately, type families don't really help on the how to write
generic but not completely general instances right now, and in fact
are incompatible with overlapping instances, making some things
impossible! I think
that we may find the object from its
identifier.
Well, here comes the trouble:
GameStructs.hs:16:9:
Functional dependencies conflict between instance declarations:
instance (Binary a) = Binarizable a a
-- Defined at MagBots/GameStructs.hs:16:9-37
instance Binarizable
Am Samstag 17 April 2010 19:14:02 schrieb Limestraël:
Hello,
Well, here comes the trouble:
GameStructs.hs:16:9:
Functional dependencies conflict between instance declarations:
instance (Binary a) = Binarizable a a
-- Defined at MagBots/GameStructs.hs:16:9-37
to automatically define a Binary as
an instance of Binarizable.
2010/4/17 Daniel Fischer daniel.is.fisc...@web.de
Am Samstag 17 April 2010 19:14:02 schrieb Limestraël:
Hello,
Well, here comes the trouble:
GameStructs.hs:16:9:
Functional dependencies conflict between instance declarations
and functional dependencies don't work as one would
naively expect.
And for GameObject, the sole matching type is String.
In other words, GameObject implies String.
I would have undestood the error if GameObject was also an instance of
Binary (then the two instances would match), but it's
On Sat, Apr 17, 2010 at 4:01 PM, Limestraël limestr...@gmail.com wrote:
I would have undestood the error if GameObject was also an instance of
Binary (then the two instances would match), but it's not the case...
As Daniel Fischer has mentioned, presumably a Binary instance could
later be
Ok, so I am heading to a headache...
Daniel Fischer mentioned a solution using Type Families. As I read, those
are meant to replace the FunDeps, I will try this solution...
2010/4/17 Casey McCann syntaxgli...@gmail.com
On Sat, Apr 17, 2010 at 4:01 PM, Limestraël limestr...@gmail.com wrote:
I
1 - 100 of 395 matches
Mail list logo