Skip to content

Conversation

@fabianhjr
Copy link
Contributor

No description provided.

@fabianhjr fabianhjr marked this pull request as draft May 3, 2020 03:50
@fabianhjr fabianhjr force-pushed the generalize-nat-hack branch 2 times, most recently from 3948eaa to 2840e23 Compare May 3, 2020 04:31
@fabianhjr fabianhjr marked this pull request as ready for review May 3, 2020 04:37
@fabianhjr
Copy link
Contributor Author

Helped me improve the performance of an alternative idris2 prelude I am playing with, tested with mock of ProjectEuler problem #1:

module NaiveSolution

import Prelude

import Data.Integral
import Data.Nat.Integral

main : LinkedList Nat
main = filter (`divBy` (the Nat 3)) [(the Nat 1)..100]

@fabianhjr fabianhjr force-pushed the generalize-nat-hack branch 2 times, most recently from 2e4ecb6 to cd106f6 Compare May 3, 2020 07:02
@fabianhjr fabianhjr marked this pull request as draft May 3, 2020 07:05
@fabianhjr
Copy link
Contributor Author

Marceline discovered that this PR causes an explosion of memory usage while compiling Idris2 in Core/Binary (Extra ~ 5GB or so of memory usage)

@fabianhjr fabianhjr marked this pull request as ready for review May 3, 2020 07:33
@fabianhjr fabianhjr force-pushed the generalize-nat-hack branch from cd106f6 to 16550e6 Compare May 8, 2020 04:52
@edwinb
Copy link
Owner

edwinb commented May 9, 2020

This does make the nat hack a bit less hacky, thanks! Is the compile time performance still an issue? Sometimes that can be due to ambiguity resolution going a bit out of control.

@fabianhjr
Copy link
Contributor Author

Yes, there is still an issue with Idris1 compilation of Idris2.

Idris2 runs fine though.


-- Prim Nat Optimizations

<|> do pragma "builtinNatZero"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we refactor this as something like:

do c <- builtinPragma
   n <- name
   atEnd indents
   pure (c n)

where builtinPragma is a big choice of parsers of the form
PrimNatSucc <$ pragma "builtinNatSucc"

Co-authored-by: MarcelineVQ <marcythevq@gmail.com>
@fabianhjr fabianhjr force-pushed the generalize-nat-hack branch from 16550e6 to a8e099b Compare May 15, 2020 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants