How to open .LHS files on iOS
To open .LHS files on iOS, use the Files app to preview it as text; if it does not render well, share it to a text-editor app or transfer it to a desktop for proper editing/compilation (compiling with GHC is typically not available on iOS).
Step-by-step instructions
- Use the Files app to preview it as text; if it does not render well, share it to a text-editor app or transfer it to a desktop for proper editing/compilation (compiling with GHC is typically not available on iOS).
Common issues
The file opens, but the code parts look wrong
Literate Haskell relies on specific conventions to distinguish documentation from code; viewing it in a word processor or with incorrect text settings can make the code blocks hard to identify.
- Open the file in a plain-text/code editor rather than a word processor.
- If you are compiling, use GHC (it applies the literate pre-processor for .lhs) and confirm the file follows literate conventions described in the Haskell report.
Compilation fails because it is treated like normal .hs source
If the toolchain is not using a literate-aware compilation path, the documentation lines can be interpreted as code and cause errors.
- Compile with GHC using the .lhs file directly so the literate pre-processor stage is applied.
- Confirm you did not rename a .hs file to .lhs (or vice versa) without adjusting the file’s content to match literate conventions.
My system does not recognize .lhs / opens it with the wrong app
File-type associations vary by platform; some systems may not have a built-in association for Literate Haskell.
- Use “Open with…” and choose a text editor, then set it as the default for .lhs if desired.
- On Linux desktops, recognition can depend on the shared MIME database installed on the system.
Security note
.lhs files are plain text, but they can contain Haskell code that may run arbitrary actions when compiled/executed; treat untrusted .lhs files like any other source code you might run.