Learning Haskell Week01 - Getting Started With Haskell Using VS Code

Поделиться
HTML-код
  • Опубликовано: 20 дек 2024

Комментарии • 108

  • @garret930
    @garret930 3 года назад +4

    You are literally the only one on RUclips who has very clearly explained how to get Haskell setup and running. VS is a bonus, thank you!

  • @JB-mz7wj
    @JB-mz7wj 3 года назад

    This is the best tutorial on RUclips for downloading and using Haskell on VSCode. So easy to follow, thank you!

  • @Soul9Knight
    @Soul9Knight Год назад +1

    For anyone who had the same problem as me where it would tell you that "stack" is an unrecognised keyword or smth along those lines, try restarting VS and it should work. Worked for me.

  • @Mnerd7368
    @Mnerd7368 3 года назад +4

    Thanks this still works on macOS in late 2021. This was the toughest programming language to install. Thanks for the tutorial. Really crystal clear and understandable.
    Reference on how to create a new Haskell project. :^)
    9:03
    9:45
    15:08

  • @deadlyshadowguy992
    @deadlyshadowguy992 3 года назад +18

    Thanks so much man, very easy to follow! Now I can start my coursework lol

  • @laraksr6222
    @laraksr6222 3 года назад +3

    Thank you so much for this! I was looking for a tutorial on how to use VSCode for hours now and I finally came across yours!! I really appreciate the effort you put into making this! Thank you so so much :)

  • @tomzhao6113
    @tomzhao6113 3 года назад +3

    A modern and good way to explain Haskell

  • @nicolassantiagopenna1074
    @nicolassantiagopenna1074 3 года назад +1

    Man I love you, I was struggling to make it work, and your video saved me!

  • @arthurion
    @arthurion 4 года назад +1

    Russia here, hi everyone. Good luck! Thanks for this video.

  • @keirakaitlynn
    @keirakaitlynn 3 года назад +3

    So I built it, ran it, and it prints "SomeFunc," but the first line of Main.hs ("module Main where") is underlined in red with this message:
    "ghcide compiled by GHC 8.10 failed to load packages: : cannot satisfy -package TestHaskell-0.1.0.0
    (use -v for more information).
    Please ensure that ghcide is compiled with the same GHC installation as the project.cradle".
    Any ideas on how to fix this? Haven't been able to find anything on this. I'm able to use stack ghci to test the functions.

    • @sebastian-daquanglocknerjr1883
      @sebastian-daquanglocknerjr1883 3 года назад

      Got this issue as well

    • @roshni7498
      @roshni7498 3 года назад

      I have got this error too on MacOS vs. Although it is still runnable and gives the output of the someFunc.

    • @ujjawalsinha8968
      @ujjawalsinha8968 3 года назад

      I also faced this issue. There is nothing I could find on this. I switched to using simple-ghc extension for ide, and Brittany for code formatting. I am 😊 now

  • @BlackCharizard123
    @BlackCharizard123 3 года назад +1

    i did everything exactly as you said. It was going fine but at the 15:15 mark. I got an error that said:
    Variable not in scope: add :: t0 ->t1 -> t
    Perhaps you meant one of these:
    'and' (imported from prelude), 'odd' (imported from prelude)

    • @CurtisDAlves
      @CurtisDAlves  3 года назад +1

      I'm guessing you just forgot to save your file or didn't load it into GHCi

  • @akaluk
    @akaluk 4 года назад +7

    How do you get the buttons (Load GHCI, Run File, QuickCheck) on the status bar to appear? Is it an extension? Saw you using it in next video but they dont appear for me

    • @CurtisDAlves
      @CurtisDAlves  4 года назад +5

      You don't need them, you can just use the terminal, but make sure the Haskelly (yes with a y) extension is installed and do a stack build from the terminal manually at least once

  • @Samarnat01
    @Samarnat01 3 года назад

    Thanks man.
    Exactly what I was expecting to setup before starting to learn Haskell.

  • @artherladett442
    @artherladett442 3 года назад

    Thanks M. D'Alves. Look forward to learning more

  • @akaluk
    @akaluk 4 года назад +4

    No idea if this is useful at all for new programmers but i've spent 8 hours trying to install this piece of trash language and your video for a college course and your video finally got me through it

    • @CurtisDAlves
      @CurtisDAlves  4 года назад +1

      Glad to help. The reason alot of programming languages/tools are difficult to install is most of them assume you are already a competent programmer and are using a "package manager". This is far from a unique haskell problem, especially on windows I find many students have a lot of trouble getting a good python setup going, and that's one of the more accessible languages. If you are interested in figuring out how to use a package manager for installing these kinds of tools, maybe check out this video ruclips.net/video/Ze42MmGG0zQ/видео.html

    • @akaluk
      @akaluk 4 года назад

      @@CurtisDAlves that definitely helped too, never saw any motivation for using these either before now.

  • @erfelipe
    @erfelipe 3 года назад +1

    Thank you very much. I really need this help in macOS.

  • @THEBOSSDYNIMATE
    @THEBOSSDYNIMATE 2 года назад +1

    I don't see the "Stack build" or "Load GHCI" on VScode, is there any way to make them appear for me

  • @Web3Chris
    @Web3Chris 3 года назад

    when i input stack build @ 12:24 i do not get any response back it.
    can someone help me.

    • @tomCatzy
      @tomCatzy 3 года назад

      When i do a stack build in a powershell outside of VSC I get this result: Preparing to download msys2-20210604 ...
      Download expectation failure: HttpExceptionRequest Request { ... } ConnectionTimeout. NO build . Stack is installed and path set etc... I do wonder ?

  • @jakobn123
    @jakobn123 4 года назад +1

    Hello. Nice video. After i reopen a project, all the buttons in the status bar are missing (Load GHCI, Stack Test, Stack Build, Stack Run). I can still build and run my program by using command lines in the terminal. Any idea how to get the buttons back? I tried to reload the extensions with no luck.
    Also how do i get ghci to show the type of an expression? (Nvm found the :info command helpful!)

    • @CurtisDAlves
      @CurtisDAlves  4 года назад +1

      Make sure the Haskelly extension (yes with a y at the end) is installed (it usually installs with the Haskell extension but not always) and build the project with stack build from the terminal manually at least once

  • @livvyrox999
    @livvyrox999 3 года назад

    Thanks man, super helpful!!! best tutorial out there

  • @ColinHarm
    @ColinHarm 4 года назад

    Hi Curtis, I was following along but had to stop at 15:35 you demonstrate using the status bar to load GHCI "commands", my status bar does not have any commands, other than the normal from a basic install. LHS has icons for "Problems" and RHS has editor information. Is this functionality a seperate plug in? I googled for about an hour to try to find the solution but came up with nothing specific to this.

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      Sometimes you need to load a project and build it manually from the terminal with stack build, then restart before it appears. As a side note: you don’t really need any of those buttons you can just use the commands from terminal manually

    • @pendax
      @pendax 4 года назад

      @@CurtisDAlves I don't have these buttons either, but they would be very neat. I don't really understand what you mean by "load a project and build it manually". Is it the project I created with stack new ProjectName?

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      @@pendax "load the project and build it manually" means open the terminal and type in "stack build" to build it or "stack ghci src/Lib.hs" to load it into ghci

    • @pendax
      @pendax 4 года назад

      @@CurtisDAlves I see. Well, it doesn't help. I'm on a Mac. Maybe there is a conflict with some other extension I have? I will try to disable some.

    • @pendax
      @pendax 4 года назад

      Answering myself: Disabling all extensions except Haskell and Haskell Syntax Highlighting didn't help.

  • @shreyaj5181
    @shreyaj5181 4 года назад

    at 13:35 I am not able to type the code stack build and get any results therefore not being able to edit the code. and I also don't see any shortcuts on the bottom blue bar. Any suggestions?

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      Gonna have to be more specific than "not able to type the code stack build" ... did you make sure stack is installed?? did you open the terminal?? Did you make sure you are on the terminal tab and not the output tab like i showed?? do you have a haskell project open in the first place?? Also you should be able to "edit the code" regardless of if you can run stack build/ghci

    • @shreyaj5181
      @shreyaj5181 4 года назад

      Curtis D'Alves do you have office hours where maybe I can show it to you or speak directly. I’m sure I followed all the steps but I’m new to coding so I’m a little lost.

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      Šhrëya J please contact me either on Microsoft Teams or by email about that

  • @nitusah1985
    @nitusah1985 2 года назад

    Any suggestion, I wanna execute add function, Instead of showing Lib > showing ghci> with a warning printing the result.

  • @alemoreira7391
    @alemoreira7391 3 года назад

    Thank you so much! The only video that really helped me!!

  • @Shady-ln3qp
    @Shady-ln3qp 4 года назад

    Thanks for the video man , keep it up . loved the content

  • @TestereNecmi123
    @TestereNecmi123 6 месяцев назад

    If I am still using the command line to run, why am I using an IDE? I can use notepad++ instead. Why doesn't run button working? I installed haskelly. No change! Any idea?

  • @1princess111
    @1princess111 3 года назад +1

    how do you create a project with ghci, instead of stack on macOS

  • @D3athW1ng
    @D3athW1ng 3 года назад

    hmm getting perm denied error on stack build ... looks like the location of where the build files are stored didn't get installed ... thoughts?

    • @CurtisDAlves
      @CurtisDAlves  3 года назад

      Are you on windows? Reinstall and change the install location, make sure you have permissions on those folders

  • @jemkavak9679
    @jemkavak9679 3 года назад

    Hey Curtis, I have tried restarting VS Code but the Stack buttons dont appear, what shoud I do?

    • @CurtisDAlves
      @CurtisDAlves  3 года назад

      The haskelly extension (yes with a y) gives those buttons, but my advice is just use the terminal instead as I do most of the time in my videos, those buttons are just shortcuts and not needed

  • @ssssssssssarah
    @ssssssssssarah 4 месяца назад

    how did he save the add function?

  • @tommytran4223
    @tommytran4223 4 года назад

    Hi Curtis, i've got a Problem, when I try to execute "stack new Projekt" this leads to this excepetion :
    "Downloading template "new-template" to create project "helloworld" in helloworld\ ...
    There was an unexpected HTTP error while downloading template new-template: HttpExceptionRequest Request {
    host = "raw.githubusercontent.com"
    port = 443
    secure = True
    requestHeaders = [("User-Agent","The Haskell Stack")]
    path = "/commercialhaskell/stack-templates/master/new-template.hsfiles"
    queryString = ""
    method = "GET"
    proxy = Nothing
    rawBody = False
    redirectCount = 10
    responseTimeout = ResponseTimeoutDefault
    requestVersion = HTTP/1.1
    }
    (ConnectionFailure user error (Network.Socket.gai_strerror not supported: 11003))"

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      This is most likely due to your internet connection, try again making sure you are connected to the internet

  • @MarshmallowMadnesss
    @MarshmallowMadnesss 3 года назад

    Is this fairly simple to uninstall? I only need Haskel for one assignment and dont want all this on my PC.

    • @CurtisDAlves
      @CurtisDAlves  3 года назад +1

      Just delete the ~/.stack directory after, although if you're in computer science i highly recommend learning Haskell beyond one assignment. Functional programming is here to stay

  • @sapnashah4807
    @sapnashah4807 3 года назад

    hello . Thank you for ur help when i tried to change the name after writing the command cd documents it shows error . It shows cant find the path ...... it doesnt exist what should i have to do as i am beginner for this . Please reply it as soon as you can thank you

  • @jonathantea913
    @jonathantea913 3 года назад

    How did u get vs code to show the preview function type above the code? are u using an extension? thanks

    • @CurtisDAlves
      @CurtisDAlves  3 года назад

      Yea I explain in the video how to install the Haskell extenstion

    • @jonathantea913
      @jonathantea913 3 года назад

      @@CurtisDAlves ive downloaded the haskell ext but i dont get the type on hover

    • @CurtisDAlves
      @CurtisDAlves  3 года назад

      @@jonathantea913 it's possible your code has an error elsewhere that's preventing the type checker from inferring whatever you've selected, or the Haskell extension just didn't install correctly

  • @SIeexic
    @SIeexic 3 года назад

    when I go in PowerShell and run 'stack ghci' it just keeps trying to download things, I have already ran it multiple times but it doesn't ever launch the Haskell interpreter, just tries to do the download again and again. Any help?

    • @CurtisDAlves
      @CurtisDAlves  3 года назад

      The first time you run stack it will download ghc, just let it do it's thing and you shouldn't have to download it again unless you specify a different resolver

    • @SIeexic
      @SIeexic 3 года назад

      @@CurtisDAlves I figured it out, it was having problems decompressing. So every time I tried to run 'stack ghci' it would fail and try again

  • @diogoribeiro8967
    @diogoribeiro8967 4 года назад

    Hi! your video was really helpful, thanks!!
    Though I don't have the options you used at minute 13:16.
    Plus whenever i try to run the add function it always returns this error message: "variable not in scope: add :: Integer -> Integer -> t".
    Can someone help me out?

    • @CurtisDAlves
      @CurtisDAlves  4 года назад +1

      You don't really need those buttons, you can just enter `stack build`, `stack run` or `stack ghci src/Lib.hs` in terminal directly. However making sure the Haskelly extension (yes with a y) and the Haskell extension are both installed and then restarting vs code might help. Also you might have to run `stack build` from terminal at least once with a new project.
      As for your other issue, did you make sure to save the file before loading into ghci??

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      if you don't have those options, you could install try installing the haskell extension. However you don't really need them, you could load ghci through the terminal like I show you. If you are getting "variable not in scope" you probably didn't load the file properly into ghci (possibly there was an error that prevented it from loading or you didn't properly point stack ghci to the correct file)

    • @Sternclamp
      @Sternclamp 3 года назад

      I had the same problem, just simply save the file and write "stack build" and it will work.

  • @max-pf4jg
    @max-pf4jg 4 года назад

    How do you open the VS Code terminal on a mac

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      The same as windows, there should be a terminal tab at the top

  • @ssssssssssarah
    @ssssssssssarah 4 месяца назад

    hi i still got somefunc even when i wrote hello world why did that happen can someone help please

  • @rayeshen2954
    @rayeshen2954 3 года назад +1

    Hi, Thanks for sharing!
    I have a question regarding to load GHCI, when I type stack ghci src/Lib.hs, it works well and load the Lib module, however when I try the second way by just clicking the load GHCI in the blue bar, it says
    1 of 3] Compiling Lib ( D:\\data\AAhaskell\haskell1\src\Lib.hs, interpreted )
    [2 of 3] Compiling Main ( D:\data\AAhaskell\haskell1\app\Main.hs, interpreted )
    [3 of 3] Compiling Paths_haskell1 ( D:\\data\AAhaskell\haskell1\.stack-work\dist\274b403a\build\autogen\Paths_haskell1.hs, interpreted )
    Ok, three modules loaded.
    Loaded GHCi configuration from C:\\Users\\Ruiyi Shen\\AppData\\Local\\Temp\\haskell-stack-ghci\\e75debef\\ghci-script
    : error: can't find file: Lib.hs
    Failed, no modules loaded.
    May I ask why this error happen?

  • @NoneStopDamage
    @NoneStopDamage 3 года назад

    I keep getting the error " warning: Multiple files use the same module name:
    * Paths_test found at the following paths"

    • @CurtisDAlves
      @CurtisDAlves  3 года назад

      It's prety safe to ignore that warning, however if you run "stack clean" (or manually remove the .stack-work directory) it should get rid of it

    • @NoneStopDamage
      @NoneStopDamage 3 года назад

      @@CurtisDAlves When i try to run GHCI src/Lib. hs I get an error it wont run. I can do everything up until that point

    • @CurtisDAlves
      @CurtisDAlves  3 года назад

      @@NoneStopDamage I'm guessing you're not executing the command from the project root, P.S did you see there's an updated version of this video that clears up some of these issues? It's in the video description

  • @jayannamorsolo796
    @jayannamorsolo796 4 года назад

    Hello Curtis, i have followed your steps in installing haskell, its already been hours but it is still downloading, there's nothing wrong in this right? probably just the internet connection? or do i have to reinstall i again?, im very sorry im a beginner.
    ghc-8.8.4: 2.18 MiB / 195.22 MiB ( 1.12%) downloaded...
    Network.Socket.recvBuf: invalid argument (Invalid argument)

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      Looks like poor internet connection or the server it's downloading GHC from is overloaded

  • @razan6579
    @razan6579 3 года назад

    Thank you so much for the tutorial

  • @vicsubi
    @vicsubi 4 года назад

    Hi, when I try the command "stack new TestHaskell", the folder doesn't pop up in my Documents.

    • @CurtisDAlves
      @CurtisDAlves  4 года назад +1

      so before you execute the command, use the command pwd to see the path of the directory you are currently in. The folder will be created inside of that directory

  • @rmiliming
    @rmiliming 4 года назад

    Hi Curtis Thank you very much for your video, but I had an issue while following your instructions on setting up the first Haskell Project. My problem is that I failed to build TestHaskell and I received an error message saying 'C:\Users
    mili\AppData\Local\Programs\stack\x86_64-windows\ghc-8.8.4\bin\ghc-pkg.exe'
    exited with an error:
    ghc-pkg.exe: hLock: permission denied (Access is denied.)
    ), Can you help thank you !

    • @rmiliming
      @rmiliming 4 года назад

      and at the top of Main.hs and Lib.hs, the lines " module Main where" and "module Lib" both have curly lines underneath, with error message: readCreateProcess: stack "exec" "ghc" "--" "-rtsopts=ignore" "-outputdir" "C:\\Users\
      mili\\AppData\\Local\\Temp\\hie-bios-98c9848bfed41b00" "-o" "C:\\Users\
      mili\\AppData\\Local\\hie-bios\\wrapper-4da94d68375fab32d2147da1837e9611.exe" "C:\\Users\
      mili\\AppData\\Local\\hie-bios\\wrapper-4da94d68375fab32d2147da1837e9611.hs" (exit 1): failedcompiler
      Peek Problem (Alt+F8)
      No quick fixes available

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      Sounds like you tried to create a stack project in a directory you don’t have permission to. Try using the cd command to change directories (say to your Documents by doing cd ~/Documents) and create it there

    • @rmiliming
      @rmiliming 4 года назад

      @@CurtisDAlves hi Curtis, thank you for your reply. It seemed that antivirus is the problem for me, as whenever I tried to build a new hs file, there will be a pop up from Norton, saying data protector has blocked an action by Haskell server. After I asked Norton to exclude specifically such action, I could successfully compile and run my hs files.
      However, the problem is that the curly lines under "module Main where" and "module Lib" remain. How can I remove the curly lines and its associated error messages as shown in my second question above?

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      @@rmiliming I'd try just restarting vs code and creating a new project

  • @Bijay007
    @Bijay007 4 года назад

    For some reason when I type "Stack New TestHaskell" to create a new folder, it gives the error "The term Stack is not recognize as the name of the cmdlet, function..... verify that the path is correct and try again." Any solutions?

    • @CurtisDAlves
      @CurtisDAlves  4 года назад +1

      So first thing first, are you capitalizing stack and new?? Don’t do that. Otherwise, it seems you failed to properly install stack. Try reinstalling and making sure the install location is in your PATH variable

    • @Bijay007
      @Bijay007 4 года назад

      @@CurtisDAlves Well it worked, I actually downloaded it another folder in another drive. The curious thing is though installing Haskell Packing tool automatically creates a folder called "Bin" which I also had to specify in my directory for the new Test Haskell folder to be created. That part still eludes me a bit.
      Edit: Nope now it works if I just specify the drive, don't even need to mention the folder in which the stacking tool is installed, guess I messed up somewhere before.
      Edit 2: And now it works even in other drives. I am now officially confused as to why it did not work before.

    • @markdatton1348
      @markdatton1348 3 года назад

      I've had a similar problem, on Windows 10, where stack worked in every scenario except in VS Code, and as stupid as it sounds, a simple restart fixed it, so it may be something to do with Windows as opposed to the applications. I also have no idea though, so take it with a grain of salt, It worked after a restart.

  • @chatrughanprasad7778
    @chatrughanprasad7778 3 года назад

    Great Brother you are life sever Thank you

  • @yaoniko6096
    @yaoniko6096 4 года назад

    Hi, at 15.37, when i type add 1 2 in to VS code, it returns error. I did exactly what you did but it didn't work at all

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      What was the error exactly?? Did you make sure to load the file into ghci properly? (i.e was the file saved, did you write stack ghci src/Lib.hs)

    • @ArthurHenriqueSL
      @ArthurHenriqueSL 4 года назад

      @@CurtisDAlvesIn my case, the error message is this:
      Lib> add 1 2
      :2:1: error:
      * Variable not in scope: add :: Integer -> Integer -> t
      * Perhaps you meant one of these:
      `and' (imported from Prelude), `odd' (imported from Prelude)

    • @ArthurHenriqueSL
      @ArthurHenriqueSL 4 года назад

      I did catch my mistake. I didn't save the project before the stack ghci src/lib.hs. Simple mistakes build giant debugging. LOL

  • @nemanjam6574
    @nemanjam6574 4 года назад

    Hi, I want to ask when we watch all videos, what level of knowledge do we have in Haskell?
    After this tutorial, can we move on to learning the Yesod framework? Thanks.

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      I'm not done these tutorials yet, but by the time we are finished you should have a beginners level's knowledge of Haskell. Yesod is a fairly advanced framework, I would recommend continuing to learn more intermediate level haskell through a book like Real World Haskell before tackling it

    • @nemanjam6574
      @nemanjam6574 4 года назад

      @@CurtisDAlves I start with Real World Haskell book, but at some point the book became very complicated, so I came to your tutorial. Do you maybe familiar with Yesod and can you recommend me some literature?

    • @CurtisDAlves
      @CurtisDAlves  4 года назад

      @@nemanjam6574 these tutorials and Learn You A Haskell are good for beginners, then Real World Haskell movingore intermediate, then try your own projects and maybe some simpler frameworks

  • @anthonylavoye2778
    @anthonylavoye2778 2 года назад

    Was helpful, thanks

  • @AskeraliMaruthullathil
    @AskeraliMaruthullathil 4 года назад

    A Good start

  • @jonathanmoore5619
    @jonathanmoore5619 2 года назад

    Thks, great video. Easy to follow. -ve => font too small.

  • @AnotherLeetcode
    @AnotherLeetcode 3 года назад

    Super helpful!

  • @gdaftrnoon-xe9xh
    @gdaftrnoon-xe9xh 2 месяца назад

    Thank you so much

  • @royscheffers7656
    @royscheffers7656 2 года назад

    Great tutorial and set up to get started with Haskell, got here through to the Plutus Pioneer Program, like if you are enrolled as well 🔥😉

  • @dy6697
    @dy6697 3 года назад

    Many thanks for this

  • @MrExercice
    @MrExercice 4 года назад

    thanks :)