Haskell for Imperative Programmers #24 - Environment

แชร์
ฝัง

ความคิดเห็น • 12

  • @mouduge
    @mouduge 22 วันที่ผ่านมา

    Great series, thanks! 👍
    A note for Linux newbies: at 10:20, when you type `USER="Haskell user"`, you are assuming that the `USER` environment variable has already been exported. This only works because this is a pretty standard variable that is usually exported in your system's init scripts. But if you were to use a different variable name, like `GREET_USER`, then you would have to type `export GREET_USER="Haskell user"`, or else the variable would only be visible to the current shell, not to subprocesses like `greet`.
    This is why you had to type `export USER` at 10:32, after the variable was `unset`. Once a variable is exported, you can change its value without exporting it again, and the updated value will be available to subprocesses.
    Alternatively, you could set the variable only for the subprocess like this:
    GREET_USER="Haskell user" ./greet
    Hope this helps someone.

  • @micknamens8659
    @micknamens8659 2 ปีที่แล้ว +4

    The functions 'withArgs' and 'withProgName' could be used for mocking in (self-contained) unit tests. There is also 'withEnvironment' for environment variables .

  • @moisesbr
    @moisesbr 2 ปีที่แล้ว +3

    Excellent series, very helpful!
    Question: why >> is present in lines 23 and 25, and absent in lines 13-14?

  • @bootyhole
    @bootyhole 4 ปีที่แล้ว +1

    Diese Serie ist echt super, danke dir!

  • @santiagolerin
    @santiagolerin 4 ปีที่แล้ว +3

    There, take your well earned like.
    I really like this series, I'm impressed, because one of the first times that I actually get to the end of something like this. Thank you. I'll continue watching till the end of the playlist. The videos are very clear, concise and easy to follow (unlike this comment). Just thanks.

    • @lyrictroy6717
      @lyrictroy6717 3 ปีที่แล้ว

      a tip : watch series on Flixzone. Me and my gf have been using them for watching a lot of movies recently.

  • @sascha-oliverprolic923
    @sascha-oliverprolic923 2 ปีที่แล้ว

    Thanks man, awesome as always.

  • @zsytssk5176
    @zsytssk5176 3 ปีที่แล้ว

    can I get the source code for this video?

  • @micknamens8659
    @micknamens8659 2 ปีที่แล้ว

    9:30 In a code review I would request that the variable in line 17 should be renamed to 'userName'. :-)
    The function argument of the 'maybe' call could be freeze-dried to point-less style: '((greeting ++ " ") ++)'.
    The test for '-h' or '-v' should only consider the first command argument.