Skip to content
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

Can't iterate over all possible values of a table #146

Closed
duvenaud opened this issue Jul 8, 2020 · 3 comments
Closed

Can't iterate over all possible values of a table #146

duvenaud opened this issue Jul 8, 2020 · 3 comments
Labels
good first issue Good for newcomers

Comments

@duvenaud
Copy link
Contributor

duvenaud commented Jul 8, 2020

I'm writing a test to see if probabilities sum to one over the set of all possible inputs. Normally, one has to write tedious code to iterate over the entire set, but Dex should shine at this! However, writing e.g.
seqs = for seq:((Fin 3)=>(Fin 4)). seq
crashes the interpreter:

Unexpected type ((Fin 3)=>(Fin 4))
CallStack (from HasCallStack):
  error, called at src/lib/Embed.hs:600:8 in dex-0.1.0.0-WMAsfoEK61B3EtpA608ix:Embed

Amusingly, this somehow corrupted the interpreter which then printed

UnexpectedU nteyxppee c(t(eFdi nt y3p)e= >(((FFiinn  43)))=
>C(aFlilnS t4a)c)k
 C(aflrloSmt aHcaks C(aflrloSmt aHcaks)C:a
l l Setrarcokr),: 
c a lelrerdo ra,t  csarlcl/eldi ba/tE msbrecd/.lhisb:/6E0m0b:e8d .ihns :d6e0x0-:08. 1i.n0 .d0e-xW-M0A.s1f.o0E.K06-1WBM3AEstfpoAE6K0681iBx3:EEtmpbAe6d0
8ix:Embed
@dougalm
Copy link
Collaborator

dougalm commented Jul 8, 2020

Yes, we don't allow table types as index sets right now. There's no fundamental reason not to, except that the space gets very big very quickly!

The bad error message is for the same reason as yesterday's issue. Since rewrite #101 we're not checking index set type classes.

My guess for the corruption is that we're writing past the end of an array somewhere, which is overwriting the in-memory program. Is it reproducible?

@duvenaud
Copy link
Contributor Author

duvenaud commented Jul 9, 2020

Okay, well it's not blocking me. But if it works someday, it'll be a cute example of the power of being able to compose all of Dex's abstractions arbitrarily.

As for reproducing the memory corruption: It happened consistently yesterday but I can't trigger it again today.

@apaszke apaszke added the good first issue Good for newcomers label Oct 9, 2020
@duvenaud
Copy link
Contributor Author

Closed by #876.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants