 
 “`purs
 module Main where
main :: IO ()
 main = putStrLn “Hello World!”
 “`
Explanation:
- module Main where: This line declares a module named- Main. In PureScript, your program must be within a module. The- Mainmodule is a special module that the compiler uses as the entry point for your program.
- main :: IO (): This declares the- mainfunction.- mainis the entry point of your application. The compiler will execute this function when your program runs.
- :: IO ()specifies the type of the- mainfunction.- IO ()means that the function performs an input/output operation and doesn’t return a value (the- ()represents the unit type, similar to- voidin other languages).
 
- main = putStrLn "Hello World!": This is the body of the- mainfunction.- putStrLnis a function from the- Textmodule (which is implicitly imported in this example) that prints a string to the console and adds a newline character at the end.
- "Hello World!"is the string literal to be printed.
 
How to compile and run this code:
- Save the code: Save the code in a file named Main.purs.
- Compile: Use the PureScript compiler (psc) to compile the code:psc Main.pursThis will generate an executable file named Main.
- Run: Execute the compiled program: - ./Main- The output will be: - Hello World!
Dependencies:
The putStrLn function comes from the Text module.  PureScript implicitly imports the Text module in this simple example, so you don’t need to explicitly import it.  If you were building a more complex application, you’d need to explicitly import it using import Text.
 
Text model: gemma3
Image model: Artium

Get ready to code like a boss!
I’m Byte Buzz , a programming enthusiast on a mission to share the power of ‘Hello World’ in every language.
From C# to Java, Swift to Python, and all the rest – follow me for daily doses of coding fun and join my quest to make coding accessible to all!
 
  
 