-
-
Notifications
You must be signed in to change notification settings - Fork 414
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
[Union] - Code generation not generating anything #770
Comments
OK, I think I'm doing something fundamentally wrong here. I just replaced the code above with the second code snippet he showed (for // LanguageExt_CodeGen.Maybe<A>
using LanguageExt_CodeGen;
public interface Maybe<A>
{
Maybe<A> Just(A value);
Maybe<A> Nothing();
}
Compared to the generated code he linked to in the wiki article, there is next to nothing here, which is probably why I'm struggling. So, anyone any idea why I'm not getting code generated? Thanks |
I think the codegen user experience would be much nicer once #754 is merged. Previously the package need a very specific project structure to make it work, now just install the package and you will be good to go. |
@garyng Thanks for the reply. I'm a bit confused though, you say "once #754 is merged", implying that it hasn't been yet, but then say "now just install..." implying that it is already merged. Please can you clarify. Also, what specific project structure do I need to make it work in the meantime? I tried a few different things, including both .NET Standard and Core, but none of them worked. Thanks again. |
@MrYossu sorry for the confusion, the process will be much easier after that PR is merged. From my own experiment, the current codegen can only be installed in a After carefully reading your previous comments, seems like you are using the correct project structure. Did you try restarting visual studio and rebuilding the whole solution? Sometimes visual studio won’t pickup the generated code. |
@garyng Thanks for the clarification. I did try it in Core, and the classes were in that project, so it should have worked. I'm pretty sure I restarted VS a few times during the course of my experiments, but will try again. If I still can't make it work, I'll post a sample and maybe you would be kind enough to take a look. Thanks again. |
@MrYossu Yeah sure! Upload the project that’s not working for you maybe, I can take a look when I get home. |
I recently archive work on a netstandard 2.1 lib project with
I found problems with .Net 3.1 that does not reference also in order to instantiate an element of the Unition you should do it via static builder, {UnionType}Con.{BranchTyppe}() in your scenario in order to instantiate a Circle should be |
also notice that even that inside
Intellisence does not notice about newly generated classes |
@ffgiraldez Thanks for the reply. I tried again, using 2.0 (as I don't have 2.1 installed), but didn't have any more luck. I zipped up a small sample project, which you can download from here. Please could you take a look and see what I'm doing wrong. Thanks again. |
@MrYossu you have misconfigured csproj file, as I pointed before, you should have
but instead you have
the key part is
when #754 is merged you could use Roslyn version |
@ffgiraldez Ah, silly me, I missed that part! With your change, the code is generated. However, ShapeCon isn't recognised until I restart VS. Is there any workaround for this? It's going to be painful having to restart every time I make a change. Thanks again for all your help |
@MrYossu have you include that? I usually build once before start using the generated helpers, also o. Rider I don't have that problem |
Hello,
Update Please read my second post here, as I think the problem I describe in this post is a result of a more fundamental problem.
I'm playing with
LanguageExt.CodeGen
and created a Core 3.1 console app project, added references toLanguageExt
andLanguageExt.CodeGen
and then copied the code from the DU section of the wiki into the Program.cs file.However, this gives compiler errors in the
GetArea
method, claiming that theRectangle
andCircle
symbols cannot be resolved.Any ideas what I did wrong? Here is the whole code file...
As a secondary question, how would I create a
Rectangle
or `Circle``? I can't find any samples that show how to work with DUs.Thanks
The text was updated successfully, but these errors were encountered: