Looks like just a bug; it is fixed in our development bits and now issues the diagnostic:

This type definition involves an immediate cyclic reference through an abbreviation

It looks like you're trying to define an 'infinite' type, which is not allowed. Depending on what you want to do, you can probably make this work by making a single case discriminated union or inserting 'lazy' somewhere to break the direct recursion.

By on 1/17/2009 12:15 PM ()

Thanks for the reply.

The problem with single case union type is that the function can not be applied directly anymore. Hence I loose functional application and I will have each time to match it. This is not satisfactory for me. If direct recursive types is not possible then how can we define for example a continuation type?

By on 1/18/2009 4:03 AM ()

Thanks for the reply.

The problem with single case union type is that the function can not be applied directly anymore. Hence I loose functional application and I will have each time to match it. This is not satisfactory for me. If direct recursive types is not possible then how can we define for example a continuation type?

That's not a problem. You can encapsulate this pattern matching in your library easily, by providing the some constructor and combinator functions. You don't actually lose your function, it's just abstracted.

Afaik continuations are usually defined as single case discrimunated unions. E.g. from the wiki page on continuations, in Haskell:

1
newtype Cont r a = Cont { runCont :: (a -> r) -> r }

Brian, I do get the "cyclic reference" warning without crashes in the latest. So maybe there's something else going on.

Also, I'm intrigued by your suggestion to adding lazy somewhere - I have tried this and the warning doesn't go away. I also don't see how this relates to the problem at hand (i.e. isn't this a typing problem, not a runtime infinite recursion problem?). Would you care to elaborate?

thanks,

Kurt

By on 1/18/2009 4:59 AM ()

Also, I'm intrigued by your suggestion to adding lazy somewhere - I have tried this and the warning doesn't go away. I also don't see how this relates to the problem at hand (i.e. isn't this a typing problem, not a runtime infinite recursion problem?). Would you care to elaborate? thanks, Kurt

You're right, it doesn't work. I was thinking that possibly changing some type Foo to Lazy<Foo> would interact with this, but it doesn't, you need a type constructor (DU case, record, etc) on the right-hand-side to break the immediate recursion in the type definition.

By on 1/18/2009 11:33 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper