shithub: MicroHs

Download patch

ref: cff38fed223a58f0e7181407a4a7fdb7f81a190b
parent: 71bbd78d3c5185bd20e9ea7df71eb9d28f81d71e
author: Lennart Augustsson <lennart@augustsson.net>
date: Thu Sep 26 15:00:02 EDT 2024

Allow "unsafe" in foreign decl

--- a/src/MicroHs/Parse.hs
+++ b/src/MicroHs/Parse.hs
@@ -310,7 +310,7 @@
   <|< uncurry Fcn  <$> pEqns
   <|< Sign         <$> ((esepBy1 pLIdentSym (pSpec ',')) <* dcolon) <*> pType
   <|< Import       <$> (pKeyword "import"   *> pImportSpec)
-  <|< ForImp       <$> (pKeyword "foreign"  *> pKeyword "import" *> pKeyword "ccall" *> eoptional pString) <*> pLIdent <*> (pSymbol "::" *> pType)
+  <|< ForImp       <$> (pKeyword "foreign"  *> pKeyword "import" *> pKeyword "ccall" *> eoptional (pKeyword "unsafe") *> eoptional pString) <*> pLIdent <*> (pSymbol "::" *> pType)
   <|< Infix        <$> ((,) <$> pAssoc <*> pPrec) <*> esepBy1 pTypeOper (pSpec ',')
   <|< Class        <$> (pKeyword "class"    *> pContext) <*> pLHS <*> pFunDeps     <*> pWhere pClsBind
   <|< Instance     <$> (pKeyword "instance" *> pType) <*> pWhere pInstBind