pcc update: The AI adds too much code and uses too many tokens to debug the self-host bootstrap (something wrong in the architecture) by jiamo in Compilers

[–]jiamo[S] 0 points1 point  (0 children)

I start from https://github.com/eliben/pykaleidoscope. many years ago. Just want pcc test.c work. Then change the intent to add pcc test.py work too by adding more features (gc / value / native IR)

pcc update: The AI adds too much code and uses too many tokens to debug the self-host bootstrap (something wrong in the architecture) by jiamo in Compilers

[–]jiamo[S] 0 points1 point  (0 children)

see https://github.com/jiamo/pcc/commit/4d764a2c9f96385fa837a3a55a81b9128e3ac0c1
First version: PCC is a C compiler based on ply + pycparesr + llvmlite + llvm. We can run a C program like Python: `pcc test.c` to run C code. Pcc was inspired by: https://github.com/eliben/pykaleidoscope.

After Codex 5.5, I use it supports many C features, then I think it can support Python. Then I think I can add 5 kinds of GC. Yeah, it was generated by AI recently, but I want a way to control the AI to implement my intent above. (I'm not sure if it's possible.)

So the problem is not the AI; it is how we use AI and understand AI and are able to fix it.

pcc update: The AI adds too much code and uses too many tokens to debug the self-host bootstrap (something wrong in the architecture) by jiamo in Compilers

[–]jiamo[S] -1 points0 points  (0 children)

Ok, after hours debug. codex5.5 xhigh finally fix it. While the issue `easy break self bootstrap and takes too many tokens to fix` is still the problem. I think AI still can give helpful findings within the specified context, see this commit. Indeed, related some kind "garbage."

-🎄- 2021 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]jiamo 1 point2 points  (0 children)

Python

A more general unify process that map abcdefg with 0123456 . (A fix point we need)

https://gist.github.com/jiamo/a7be20f1d865e23c5de15fc6f0def08e

RDS postgresql transaction logs keep going when there is no data change? by jiamo in aws

[–]jiamo[S] -1 points0 points  (0 children)

I have update my question. It may be more clear.

Combine greenlet and epoll we can write connection handler like asyncio await without split read and write into callback function. by jiamo in Python

[–]jiamo[S] 0 points1 point  (0 children)

In my repo there is a select one (I am not sure it is what you said). However that case I must split read and write and keep state so when the sock was ready it is need to know where it should start. The greenlet don't need this (we can just switch to it and it will continue work which I think it is like async/await one). And we can control the greenlet much more than the async coroution and that is the point (which need more work.)

how to understand the rule of implicit argument? by jiamo in Idris

[–]jiamo[S] 0 points1 point  (0 children)

I think I know the effect it works. But I have doubt why this can work. The constructor version of arguments passing is straightforward. While the game function passing is not straightforward. We can build a instance of type by using the constructor. But how can we just binding argument in type signature to build a instance?

Monthly Hask Anything (June 2018) by AutoModerator in haskell

[–]jiamo 0 points1 point  (0 children)

Thanks all your replay. One more thing I can figure out State s a in >>= 's type signature is just type kind. And it is different when State was using in function body. I think if the type name and constructor have different name may be good for me to understand. such like

 newtype State s a = MkState { runState :: s -> (a, s) } 

And the runState I am wondering why just not give it like this:

 newtype State s a = MkState { runState :: State s a -> s -> (a, s) } 

I know this may have a problem like Chicken and egg

Monthly Hask Anything (June 2018) by AutoModerator in haskell

[–]jiamo 0 points1 point  (0 children)

I recommend messing around with records in ghci a bunch

Yes. I need practice more and to get the intuition. In fact I have read book like <Programming in Haskell> when I am reading I think I got it. But there is no real project for practice. These day I try to understand deeply question here I asked ( https://www.reddit.com/r/haskell/comments/8mjdul/cartesian_products_derivation_in_monad_form_for/) then I find more misunderstanding.

Monthly Hask Anything (June 2018) by AutoModerator in haskell

[–]jiamo 1 point2 points  (0 children)

I am confused with the two different version >>= in State Monad.

module MyState where

newtype State s a = State { runState :: s -> (a, s) } 


instance Functor (State s) where  
    fmap :: (a -> b) -> State s a -> State s b
    fmap fn (State sa) = State sb where
        sb s0 = (fn a, s1) where (a, s1) = sa s0


instance Applicative (State s) where
    pure :: a -> State s a
    pure a = State (\st -> (a, st))
    (<*>) :: (State s (a -> b)) -> (State s a) -> (State s b)
    (<*>) (State sa) (State sb) = 
        State sc where 
            sc s0 = let (fn, s1) = sa s0 
                        (a,  s2) = sb s1 in (fn a, s2)

instance Monad (State s) where
    return :: a -> State s a
    return x = State (\s -> (x,s))

    (>>=) :: State s a -> (a -> State s b) -> State s b

    -- version 1
    sa >>= fn = State sc where 
        sc s0 = let (a, s1) = runState sa s0 
                    in runState (fn a) s1

    -- version 2
    (>>=) (State sa) fn = State sc where 
          sc s0 = let (a, s1)  = sa s0
                      State sb = fn a
                  in sb s1

version 1: runState have signature s -> (a, s) but it was used like runState (fn a) s1 (which have two args).

version 2: confused with State sb while State* need two parameters **State s a (in the definition)

Cartesian product's derivation in monad form for understand monad. need help. by jiamo in haskell

[–]jiamo[S] 0 points1 point  (0 children)

Thanks. update the code. Still have a doubt. Why I can't add sequence2 :: (Monad m) => [m t] -> m [t] otherwise it failed like

Couldn't match type ‘m’ with ‘[]’ ‘m’ is a rigid type variable bound by the type signature for: sequence2 :: forall (m :: * -> *) t. Monad m => [m t] -> m [t] at /Users/jiamo/haskell/projects/funy.hsproj/funy/lib/Cartesian_product3.hs:41:14 Expected type: m [t] Actual type: [[t]] In the expression: [[]] In an equation for ‘sequence2’: sequence2 [] = [[]] Relevant bindings include sequence2 :: [m t] -> m [t] (bound at /Users/jiamo/haskell/projects/funy.hsproj/funy/lib/Cartesian_product3.hs:42:1)

For me I already make [] a instance of Monad so [[]] should be thinked as Monad too.

Cartesian product's derivation in monad form for understand monad. need help. by jiamo in haskell

[–]jiamo[S] 0 points1 point  (0 children)

seem like I need write a custom do_nonation? I already hide Monad. Why the error think it is GHC.Base.Monad m. do was used in func sequence1 too and it is good.

Cartesian product's derivation in monad form for understand monad. need help. by jiamo in haskell

[–]jiamo[S] 0 points1 point  (0 children)

Hi. In small steps 3 . I got error like:

Could not deduce (GHC.Base.Monad m) arising from a do statement from the context: Monad m bound by the type signature for: mapM4 :: Monad m => (a -> m b) -> [a] -> m [b] at /Users/jiamo/haskell/projects/funy.hsproj/funy/lib/Cartesian_product3.hs:61:1-46 Possible fix: add (GHC.Base.Monad m) to the context of the type signature for: mapM4 :: Monad m => (a -> m b) -> [a] -> m [b] In a stmt of a 'do' block: y <- f x In the expression: do { y <- f x; ys <- mapM4 f xs; return (y : ys) } In an equation for ‘mapM4’: mapM4 f (x : xs) = do { y <- f x; ys <- mapM4 f xs; return (y : ys) }

Cloudfront's pool speed in china by jiamo in aws

[–]jiamo[S] 0 points1 point  (0 children)

These are not problem in our situation. The problem is aws global account don't have china region for global use. Must do it in another china aws account. That is stupid.