Giter Site home page Giter Site logo

idris-free's People

Contributors

raichoo avatar risto-stevcev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

idris-free's Issues

Bind not strictly positive

This snippet is taken from idris-free (https://github.com/idris-hackers/idris-free) which does not compile currently. This issue is about the error messages the compilation produces, not about the fact that Free does not compile:

data Free : (f : Type -> Type) -> (a : Type) -> Type where
  Pure : a -> Free f a
  Bind : f (Free f a) -> Free f a

instance Functor f => Functor (Free f) where
  map f (Pure x) = Pure (f x)
  map f (Bind x) = assert_total (Bind (map (map f) x))

The first error message one gets is :

Prelude.Functor.Control.Monad.Free.Free f implementation of Prelude.Functor.Functor, 
method map is possibly not total due to: Control.Monad.Free.Bind

Inspecting the docs of map gives the standard map function of the Functor interface which declares map to be total. This left me puzzled, because I was not able to get the totality state of this map implementation.

I then inspected the docs for Free

Data type Control.Monad.Free.Free : (f : Type -> Type) -> (a : Type) -> Type
    
    
Constructors:
    Pure : a -> Free f a
        
        
    Bind : f (Free f a) -> Free f a

(nothing unusual here) and finally Bind. The docs for Bind say:

Control.Monad.Free.Suspend : f (Free f a) -> Free f a
    
    
    The function is not strictly positive

I tried to find out what "strictly positive" means. Some Adga and Coq resources later (which I am not fluent with), there seems to be a problem that Free occurs on the left hand side of the constructor arrow. Again I am puzzled - why does

(::) : a -> List a -> List a 

work as a constructor for List then?

As a user of Idris, I would like that

  • Idris reports that map is not total because Bind is not strictly positive
  • Idris explains a bit better what exactly being strictly positive entitles
  • as a bonus: that Idris provides error messages which link to an error message wiki page on Github, giving more detailed information about the nature of the error.

README

This repo looks like it contains code that I would like to use in another open-source project. However, the lack of a README makes this difficult! Would you mind adding one? Some useful information to include might be

  1. What is the purpose of this repo?
  2. How can I install the software?
  3. How do I use the software?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.