#haskell - Fri 13 Apr 2007 between 00:00 and 00:15

NY Lost Funds



Pseudonym?google SmartConstructor
lambdabothttp://www.patentstorm.us/patents/6633888-description.html
Title: Method and apparatus for visually creating and testing object oriented component ...
Pseudonym?google SmartConstructor site:haskell.org
lambdabothttp://www.haskell.org/hawiki/SmartConstructor
Title: FactoryFunction - The Haskell Wiki
PseudonymAh, yes. FactoryFunction is another name.
jargonjustinSo the reason to make it like a Smart Constructor is to leave the qualification off the data, write my functor instance without it, but don't export the value constructor from the module and provide functions with the appropriate qualifications instead, right?
s/reason/way/
donsjargonjustin: I can't see how you can write a Functor instance that uses Ord.
vincenzthat's why Set is not a Functor
donsgiven the kind restriction for functors and monads.
exactly.
:t fmap
lambdabotforall a b (f :: * -> *). (Functor f) => (a -> b) -> f a -> f b
donsf :: * -> &
but Tree a :: *
jargonjustinYeah, I'm realizing I'd have to rebalance it afterwards anyway, which would require the Ord declaration and not work with the smart constructors either.
vincenzjargonjustin: There is an explanation for this
jargonjustinOkay, I'll write my own darn map function :-)
vincenz: it makes sense, just a little confusing at first because it feels like I'm sacrificing generality by working against idioms.
vincenzjargonjustin: basically Functor should only modify the elements, not the structure containing the elements, aka you keep the same structure those elements hang off of. Now if your structure relies on the elements, then this is no longer valid
jargonjustinvincenz: Yeah, I'd hoped a BST would be "close enough" (the idea of a map function applies for instance) but I can see why it won't work with the type system.
vincenzjargonjustin: it also doesn't make sense, you're modifying the structure while traversing while Functor is structure-agnostic
jargonjustinvincenz: I agree, I'm just glad I understand why Haskell won't allow it (even though the intent of fmap is such that it should.)
vincenz:)
jargonjustins/glad/satisfied/ :-/
vincenzwhy do you need Functor?
jargonjustinI don't really, I wrote a BST implementation as part of learning Haskell and was playing with type-classes. I thought mapping a BTree would be a good example.
vincenzbtreeMap?
jargonjustinAnother question, why does "instance Eq k => Eq (Entry k v) where" work but "instance Eq k => Eq (Entry k) where" not?
vincenzdifferent kinds
(Entry k) :: * -> *
(Entry k v) :: *
badger_homeseddie haskellllLLL!!
jargonjustinIsn't the datatype you're declaring an instance for supposed to be *->* ?
vincenzjargonjustin: not for Eq
jargonjustin: Eq is on pure data values
erm
and hence on types of kind *

Page: 2 9 16 23 30 37 44 51 58 65 72 79 86 

IrcArchive

NY Lost Funds