Speaking of type inference, how come this is "ambiguosly typed"?
-- test test = do (lfsr 1 1) -- pump through specified lfsr lfsr mask seed | ((seed .&. 1) == 1) = (xor post mask) | (otherwise) = (post) where post = (shiftR seed 1)
Scraping test and punching in
> lfsr 1 1
Seems to work.
Also, I can't get the hang of working with the State monad, which I'm under the impression is the best one to use in this case.
I guess I'm trying to make a Functor or something. I'm still a rookie programmer, so I don't really know.
I need state for a PRNG, obviously. I just need one tuple for now, containing a mask Bits and some state Bits.
I was gonna newtype that, but it's throwing all kinds of crazy errors again, so I was just gonna wing it with Bits.
What I would really like to do is define a Mask type of Bits and a Step type of Bits, then combine them into a Lfsr tuple type.
The reason I want to do this is to catch myself putting Mask into Step or something awful. That /would/ catch me, right?.
I can't find any good tutorials, mostly bad documentation with advanced commentary on the future of haskell.
The tutorials I can find are really specific to a hardly relevant topic and in depth in directions I can't understand.
This is obviously not a good language for beginners lol. (I do have some programming experience)
Can anyone help me some more?
Ultimately, my goal is to create a table of lfsrs, and either use locking mechanisms, or link them to each core, to ensure fast, random results.
That's why I have mask as a mutable variable - I worked really hard on conceiving an algorithm to quickly generate masks for me, which I think is pretty bad ass.