[Haskell-cafe] GPT & Haskell

MigMit migmit at gmail.com
Sat Apr 1 00:08:23 UTC 2023


That's true.

But I feel like a lot of progress in programming was made in attempt to make "non-technical people" communicate with a computer without a programmer in between. So far, despite all that was done, those attempts did not really succeed. I'm sceptical regarding AI chances, honestly. I mean, just imagine a business person suddenly finding out they can't improve the computer system by yelling at the programmer.

> On 1 Apr 2023, at 01:56, Jeff Clites <jclites at mac.com> wrote:
> 
> Yes, if you’re a programmer. A lot of real-world business scenarios are basically a non-technical person using English to give a (flawed, incomplete) specification, and a programmer using their expertise not only to implement but also to fill in the incomplete parts of the specification and also to determine what missing parts of the specification can’t be interpolated and have to be asked about. That sort of filling in missing parts based on precedent is the exact sort of thing these AI are good at.
> 
> Jeff
> 
>> On Mar 31, 2023, at 4:27 PM, Mig Mit <migmit at gmail.com> wrote:
>> 
>> How is it going to benefit anyone though? English, like all natural languages, is terrible for describing algorithms. It is way easier to just code the damn thing.
>> 
>> Sent from my iPad
>> 
>>> On 2023. Apr 1., at 1:24, Yasuaki Kudo <yasu at yasuaki.com> wrote:
>>> 
>>> There is TTS (text to speech) and STT (speech to text)  Former is easier, latter is harder.
>>> 
>>> Similarly, is it possible that we generate a huge variations of English explanation of correct compiled programs (like TTS - easy-ish, because we can program English explanations algorithmically ) and the get GPT-like-things to learn from that huge sample so it can convert human instructions to accurate programs? (like STT - hard),
>>> 
>>> 
>>>> On Apr 1, 2023, at 08:08, Branimir Maksimovic <branimir.maksimovic at gmail.com> wrote:
>>>> 
>>>> Of course it’ useless. GPT should be tested with something that can’t be found
>>>> on internet :P
>>>> 
>>>> I tried with problem euler 512, it can’t find optimal solution, but can perform
>>>> microoptimisations of existing solution, which is still impressive :P
>>>> 
>>>> Greets, Branimir.
>>>>  
>>>>> On 1. 4. 2023., at 01:01, Alexey Vagarenko <vagarenko at gmail.com> wrote:
>>>>> 
>>>>> Isn’t binary search useless for lists? It performs worse than full list traversal.
>>>>> 
>>>>> Сб, 1 апр. 2023 г. в 03:43, Branimir Maksimovic <branimir.maksimovic at gmail.com>:
>>>>> I was thoughtt from my mathematic logic proffesor in 1987 that algorithm for making algorithms
>>>>> doesn’t exist. He proved that there is no algorihm for provin hieor order logic formulas…
>>>>> 
>>>>> Greets, Branmir.
>>>>> 
>>>>> 
>>>>>> On 31. 3. 2023., at 23:37, Yasuaki Kudo <yasu at yasuaki.com> wrote:
>>>>>> 
>>>>>> I am really curious - is it possible to create a programming language designed from the ground up to be used by GPT and similar tools?
>>>>>> 
>>>>>> - Easy to specify the desired outcome
>>>>>> - Easy to verify results
>>>>>> 
>>>>>> I tried GPT4 to produce COQ proofs of Yoneda Lemma but it could not even complete the interfaces (without implementation) - they failed to compile, by being tripped up by implicit parameters etc.
>>>>>> 
>>>>>> But GPT4 gets much closer to completion compared to GPT3.5
>>>>>> 
>>>>>> I wonder what "GPT-native" programming language might look like😄
>>>>>> 
>>>>>> -Yasu
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Apr 1, 2023, at 06:24, Levent Erkok <erkokl at gmail.com> wrote:
>>>>>>> 
>>>>>>> This code is buggy when lo + hi overflows your integer type. Classic (extremely) corner  case bug: https://ai.googleblog.com/2006/06/extra-extra-read-all-about-it-nearly.html
>>>>>>> 
>>>>>>>> On Mar 31, 2023, at 1:02 PM, Gregory Guthrie <guthrie at miu.edu> wrote:
>>>>>>>> 
>>>>>>>> From a colleague:
>>>>>>>>   GPT Pretty smart(?!).
>>>>>>>> But this is of course simple, and searchable.
>>>>>>>>  Still…
>>>>>>>> --------------------------------------------------------------------------------------------------
>>>>>>>> GPT-4 when prompted:
>>>>>>>> Write binary search in Haskel. Print results using putStrLn. Ensure bug-free code by specifying preconditions, postconditions, invariants, variants, internal states.
>>>>>>>>  gives the following response:
>>>>>>>> -- Binary search in Haskell
>>>>>>>> -- Precondition: the list is sorted in ascending order
>>>>>>>> -- Postcondition: the function returns the index of the target element if found, or Nothing otherwise
>>>>>>>> -- Invariant: the search space is always within the bounds of the list
>>>>>>>> -- Variant: the search space decreases by half at each recursive call
>>>>>>>> -- Internal state: the lower and upper bounds of the search space
>>>>>>>> 
>>>>>>>> binarySearch :: Ord a => [a] -> a -> Maybe Int
>>>>>>>> binarySearch xs x = go xs x 0 (length xs - 1)
>>>>>>>>   where
>>>>>>>>     go xs x lo hi
>>>>>>>>       | lo > hi = Nothing -- base case: search space is empty
>>>>>>>>       | x == midElem = Just mid -- base case: target element is found
>>>>>>>>       | x < midElem = go xs x lo (mid - 1) -- recursive case: search in the left half
>>>>>>>>       | otherwise = go xs x (mid + 1) hi -- recursive case: search in the right half
>>>>>>>>       where
>>>>>>>>         mid = (lo + hi) `div` 2 -- calculate the middle index
>>>>>>>>         midElem = xs !! mid -- get the middle element
>>>>>>>> 
>>>>>>>> -- Print results using putStrLn
>>>>>>>> main :: IO ()
>>>>>>>> main = do
>>>>>>>>   let xs = [1, 3, 5, 7, 9] -- a sorted list of integers
>>>>>>>>   let x = 5 -- a target element to search for
>>>>>>>>   let result = binarySearch xs x -- call the binary search function
>>>>>>>>   case result of -- pattern match on the result
>>>>>>>>     Nothing -> putStrLn "Element not found" -- print a message if Nothing is returned
>>>>>>>>     Just i -> putStrLn $ "Element found at index " ++ show i -- print a message with the index if Just i is returned
>>>>>>>>  The above code runs:
>>>>>>>> https://onecompiler.com/cpp/3z48yt2pp
>>>>>>>>   <image001.png>
>>>>>>>>  _______________________________________________
>>>>>>>> Haskell-Cafe mailing list
>>>>>>>> To (un)subscribe, modify options or view archives go to:
>>>>>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>>>>>>> Only members subscribed via the mailman list are allowed to post.
>>>>>>> 
>>>>>>> 
>>>>>>> _______________________________________________
>>>>>>> Haskell-Cafe mailing list
>>>>>>> To (un)subscribe, modify options or view archives go to:
>>>>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>>>>>> Only members subscribed via the mailman list are allowed to post.
>>>>>> 
>>>>>> _______________________________________________
>>>>>> Haskell-Cafe mailing list
>>>>>> To (un)subscribe, modify options or view archives go to:
>>>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>>>>> Only members subscribed via the mailman list are allowed to post.
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> Haskell-Cafe mailing list
>>>>> To (un)subscribe, modify options or view archives go to:
>>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>>>> Only members subscribed via the mailman list are allowed to post.
>>>>> _______________________________________________
>>>>> Haskell-Cafe mailing list
>>>>> To (un)subscribe, modify options or view archives go to:
>>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>>>> Only members subscribed via the mailman list are allowed to post.
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Haskell-Cafe mailing list
>>>> To (un)subscribe, modify options or view archives go to:
>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>>> Only members subscribed via the mailman list are allowed to post.
>>> _______________________________________________
>>> Haskell-Cafe mailing list
>>> To (un)subscribe, modify options or view archives go to:
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>>> Only members subscribed via the mailman list are allowed to post.
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.




More information about the Haskell-Cafe mailing list