[curry] Re: Specifying default rules: Why and how?

From: Michael Hanus <mh_at_informatik.uni-kiel.de>
Date: Fri, 23 Nov 2018 09:36:27 +0100

Hi Jeff,

I jsut answered it on StackOverflow. Since it might be interesting
to readers of this mailing list, I include some part of it here.

The permission error is due to the fact that not all possible
intermediate representations of a Curry program are precompiled
in the Ubuntu package. Unfortunately, the "default rule translator"
of CurryPP requires one of these intermediate representations.

The Ubuntu/Debian package is intended only for using the
kernel of Curry. For other extensions and more advanced tools,
I recommend to install PAKCS manually, e.g., the current release from
https://www.informatik.uni-kiel.de/~pakcs/download.html
If you already have Ubuntu, a simple `make` should be sufficient.

Regards,

Michael

On 11/22/18 6:17 AM, Jeffrey Brown wrote:
> I've almost got currypp working! It's installed, but reports
> "pakcs-frontend: /usr/lib/pakcs/lib/.curry/Prelude.uacy: openFile:
> permission denied (Permission denied)
> ERROR: i/o error: ERROR: user error: Illegal source program". I put more
> details on StackOverflow[1].
>
> Thank you both!
>
> [1] https://stackoverflow.com/questions/53357361/specifying-default-rules-in-the-curry-language-why-and-how/53367863#comment93722810_53367863
>
> On Mon, Nov 19, 2018 at 12:07 PM Michael Hanus
> <mh_at_informatik.uni-kiel.de <mailto:mh_at_informatik.uni-kiel.de>> wrote:
>
> Hi Jeff,
>
> maybe at some tome in the future, default rules, set functions etc
> will become part of the syntax of Curry and, thus, processed by
> the standard parser.
>
> In the current "development" state, they are processed and
> implemented by the Curry preprocessor. This provides more flexibility
> for us (to play with different implementations) but allows
> also unintended uses. As a compromise, you might use CurryCheck,
> a property-based test tool which also perform some static code tests.
> For instance, running CurryCheck on your program generates the
> the message
>
> Analyzing module 'Test'...
> ==============================================================================
> STATIC ERRORS IN PROGRAMS:
> 'Test' uses default rules or det. operations but not the preprocessor!
> Hint: insert line: {-# OPTIONS_CYMAKE -F --pgmF=currypp #-}
> ==============================================================================
>
> Hence, you see what is missing...
>
> CurryCheck can easily be installed by Curry's package manager:
>
>    > cypm update && cypm install currycheck
>
> Best regards,
>
> Michael
>
> On 11/19/18 4:49 AM, Jeffrey Brown wrote:
> > Awesome! Thanks, Sergio! 
> >
> > On Sun, Nov 18, 2018 at 10:24 PM <h7sa_at_pdx.edu
> <mailto:h7sa_at_pdx.edu> <mailto:h7sa_at_pdx.edu <mailto:h7sa_at_pdx.edu>>>
> wrote:
> >
> >     Hi Jeff
> >
> >     Answered on Stackoverflow.  Good question.  The tutorial should be
> >     clear about using the preprocessor.  Sorry.
> >
> >     Sergio
> >
> >     On Sun, 18 Nov 2018, at 19:50, Jeffrey Brown
> >     <jeffbrown.the_at_gmail.com <mailto:jeffbrown.the_at_gmail.com>
> <mailto:jeffbrown.the_at_gmail.com <mailto:jeffbrown.the_at_gmail.com>>>
> wrote:
> >
> >      > I posted this question on Stackoverflow[1] yesterday and
> haven't
> >     received
> >      > any answers yet. I've duplicated the question below, but an
> >     answer posted
> >      > to StackOverflow would be more useful to future students, if
> >     you're so
> >      > inclined.
> >      >
> >      > Thanks!
> >      >
> >      > ---
> >      >
> >      > In section 3.5.6 of the Curry tutorial (pdf)
> >      >
> >     <https://www.informatik.uni-kiel.de/~curry/tutorial/tutorial.pdf>,
> >     we are
> >      > advised to use default rules to "regain control after a failed
> >     search". The
> >      > following example is given. (For clarity I have added a type
> >     signature and
> >      > curried the input.)
> >      >
> >      > lookup :: k -> [(k,v)] -> Maybe v
> >      > lookup key (_++[(key,value)]++_ ) = Just value
> >      > lookup’default _ _ = Nothing
> >      >
> >      > I can't get that to compile unless I replace the ’ with a
> '. Once
> >     I do, it
> >      > behaves like this:
> >      >
> >      > test> test.lookup 1 [(2,3)]
> >      > *** No value found!
> >      >
> >      > Question 1: What is the default declaration for?
> >      >
> >      > Why would you need to specify that a particular clause is the
> >     default one?
> >      > Won't it be arrived at one way or another, once the others
> fail?
> >      > Question 2: How is it written? Should it be written at all?
> >      >
> >      > If instead I drop the string 'default:
> >      >
> >      > lookup :: k -> [(k,v)] -> Maybe v
> >      > lookup key (_++[(key,value)]++_ ) = Just value
> >      > lookup _ _ = Nothing
> >      >
> >      > it behaves as intended:
> >      >
> >      > test> test.lookup 1 [(2,3)]
> >      > Nothing
> >      > test>
> >      >
> >      > Has the 'default syntax changed since the tutorial was written?
> >     Has it been
> >      > removed altogether?
> >      > [1]
> >      >
> >   
>  https://stackoverflow.com/questions/53357361/specifying-default-rules-in-the-curry-language-why-and-how
> >      >
> >      > --
> >      > Jeff Brown | Jeffrey Benjamin Brown
> >      > Website <https://msu.edu/~brown202/>   |   Facebook
> >      > <https://www.facebook.com/mejeff.younotjeff>   |   LinkedIn
> >      > <https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I
> >     often miss
> >      > messages here)   |   Github
> <https://github.com/jeffreybenjaminbrown>
> >
> >      > _______________________________________________
> >      > curry mailing list -- curry_at_lists.rwth-aachen.de
> <mailto:curry_at_lists.rwth-aachen.de>
> >     <mailto:curry_at_lists.rwth-aachen.de
> <mailto:curry_at_lists.rwth-aachen.de>>
> >      > To unsubscribe send an email to
> curry-leave_at_lists.rwth-aachen.de
> <mailto:curry-leave_at_lists.rwth-aachen.de>
> >     <mailto:curry-leave_at_lists.rwth-aachen.de
> <mailto:curry-leave_at_lists.rwth-aachen.de>>
> >      >
> >   
>  https://lists.rwth-aachen.de/postorius/lists/curry.lists.rwth-aachen.de
> >
> >
> >
> > --
> > Jeff Brown | Jeffrey Benjamin Brown
> > Website <https://msu.edu/~brown202/>   |   Facebook
> > <https://www.facebook.com/mejeff.younotjeff>   |   LinkedIn
> > <https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often
> > miss messages here)   |   Github
> > <https://github.com/jeffreybenjaminbrown>   
>
>
>
> --
> Jeff Brown | Jeffrey Benjamin Brown
> Website <https://msu.edu/~brown202/>   |   Facebook
> <https://www.facebook.com/mejeff.younotjeff>   |   LinkedIn
> <https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often
> miss messages here)   |   Github
> <https://github.com/jeffreybenjaminbrown>   
>
_______________________________________________
curry mailing list -- curry_at_lists.rwth-aachen.de
To unsubscribe send an email to curry-leave_at_lists.rwth-aachen.de
https://lists.rwth-aachen.de/postorius/lists/curry.lists.rwth-aachen.de
Received on Fr Nov 23 2018 - 09:37:43 CET

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:14 CEST